【发布时间】:2013-03-30 09:48:07
【问题描述】:
我在 iOS 6 中使用UIPopoverController 来呈现UITableViewController。
我正在尝试使此弹出框半透明,以便能够显示覆盖的视图。除此之外,我想要一个带有默认箭头等的标准弹出框控制器。
从 iOS 5 开始,可以使用 UIPopoverBackgroundView 定义自定义弹出背景视图。 但是,我正在努力正确设置背景。我用来设置背景视图的代码如下所示。我想仅设置 alpha 值,并将其他属性设置为其默认值。
此外,我需要如何配置显示在弹出框内的表格视图控制器,以使其视图(及其所有子视图,文本除外)也具有透明度。
谢谢!
configPopover.popoverBackgroundViewClass = [TransparentPopoverBackGroundView class];
TransparentPopoverBackGroundView.m:
#import "TransparentPopoverBackGroundView.h"
@implementation TransparentPopoverBackGroundView
@synthesize arrowOffset;
@synthesize arrowDirection;
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.alpha = 0.4;
}
return self;
}
+ (UIEdgeInsets)contentViewInsets {
return UIEdgeInsetsMake(5, 5, 5, 5);
}
+ (CGFloat)arrowHeight{
return 10.0;
}
+ (CGFloat)arrowBase{
return 10.0;
}
【问题讨论】:
标签: ios objective-c uiview ios6 uipopovercontroller