在ViewController上查看ViewController:我想在左边有一个投影?

时间:2011-11-20 18:15:37

标签: ios view uikit core-animation dropshadow

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

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];

但它不起作用,为什么?

1 个答案:

答案 0 :(得分:1)

我忘了

#import <QuartzCore/QuartzCore.h>

很抱歉。