我使用此代码向另一个视图上方的视图添加阴影。

CGRect rect = CGRectMake(90, 0, 230, 460);

FeedsViewController *feedsViewController = [[FeedsViewController alloc] init];
[feedsViewController.view setFrame:rect];
self.feedsViewController = feedsViewController;
[feedsViewController release];

[[feedsViewController.view layer] setShadowOffset:CGSizeMake(0, 1)];
[[feedsViewController.view layer] setShadowColor:[[UIColor darkGrayColor] CGColor]];
[[feedsViewController.view layer] setShadowRadius:3.0];
[[feedsViewController.view layer] setShadowOpacity:0.8];
[self.view.superview addSubview:feedsViewController.view];


但这不起作用,为什么?

最佳答案

我只是忘了

#import <QuartzCore/QuartzCore.h>


抱歉

关于ios - 在ViewController上查看ViewController的 View :我想要左侧的投影吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8203590/

10-09 08:53