【发布时间】:2012-04-20 02:46:06
【问题描述】:
我用这个好的tutorial 创建了一个自定义的 UIPopoverBackgroundView 类。
效果很好。唯一的问题是我没有得到典型的 UIPopoverController 投影,我想要它。我尝试在我的 UIPopoverBackgroundView 实例层上指定它但没有成功。我的 UIPopoverController 实例似乎没有可操作的公共视图。将其添加到弹出内容中也不起作用。
可能真的很简单:如何在使用自定义 UIPopoverBackgroundView 类时添加阴影?
// UIPopoverBackgroundView.m
-(id)initWithFrame:(CGRect)frame{
if (self = [super initWithFrame:frame]) {
_borderImageView = [[UIImageView alloc] initWithImage:[[UIImage imageNamed:@"bg-popover.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(CAP_INSET,CAP_INSET,CAP_INSET,CAP_INSET)]];
_arrowView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg-popover-arrow.png"]];
[self addSubview:_borderImageView];
[self addSubview:_arrowView];
self.layer.shadowOffset = CGSizeMake(50, 50);
self.layer.shadowColor = [[UIColor blackColor] CGColor];
}
return self;
}
【问题讨论】: