イメージを使用しない場合は?
_t.layer.shadowColor = [UIColor blackColor].CGColor;
_t.layer.shadowOffset = CGSizeMake(-6, -6);
_t.layer.shadowOpacity = 1;
_t.clipsToBounds = false;
これは影の外に作成される可能性があります。
イメージを使用しない場合は?
_t.layer.shadowColor = [UIColor blackColor].CGColor;
_t.layer.shadowOffset = CGSizeMake(-6, -6);
_t.layer.shadowOpacity = 1;
_t.clipsToBounds = false;
これは影の外に作成される可能性があります。
ステータスバーまたはタブバーの下の影付きのビューを追加します。これらのビューは、あなたのtableViewの上にあります。
CGFloat statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height;
CGFloat tabBarHeight = self.tabBarController.tabBar.bounds.size.height;
// status bar
UIView *statusBarShadowView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, statusBarHeight)];
statusBarShadowView.backgroundColor = [UIColor whiteColor];
[self.view addSubview:statusBarShadowView];
CAGradientLayer *gradientLayer0 = [CAGradientLayer layer];
gradientLayer0.frame = CGRectMake(0, statusBarHeight, self.view.bounds.size.width, 10);
gradientLayer0.colors = @[(id)[UIColor colorWithRed:0.91 green:0.91 blue:0.91 alpha:0.7].CGColor, (id)[UIColor colorWithWhite:1 alpha:0.7].CGColor];
[statusBarShadowView.layer insertSublayer:gradientLayer0 atIndex:0];
// tab bar
UIView *tabBarShadowView = [[UIView alloc] initWithFrame:CGRectMake(0, [UIScreen mainScreen].bounds.size.height - tabBarHeight, [UIScreen mainScreen].bounds.size.width, tabBarHeight)];
statusBarShadowView.backgroundColor = [UIColor whiteColor];
[self.view addSubview:tabBarShadowView];
CAGradientLayer *gradientLayer1 = [CAGradientLayer layer];
gradientLayer1.frame = CGRectMake(0, -10, self.view.bounds.size.width, 10);
gradientLayer1.colors = @[(id)[UIColor colorWithWhite:1 alpha:0.7].CGColor, (id)[UIColor colorWithRed:0.91 green:0.91 blue:0.91 alpha:0.7].CGColor];
[tabBarShadowView.layer insertSublayer:gradientLayer1 atIndex:0];
テーブルビューのフレームが変更されるので、単にtableviewに追加できますか? –
あなたはそうすることができますが、影はテーブルビューでスクロールし、固定された影の位置にいくつかの作業を行います。 – tomfriwel
これはレイヤーなので、テーブルビューに置くことができます。そしてテーブルビューと共に移動します。 –
ステータスバーやタブバーの下に影を持つビューを追加し、これらのビューは、あなたのtableViewを超えています。 [statusBar - shadowView - tableView] – tomfriwel