我正在使用 UIPopoverController
在 iOS 6 中呈现一个 UITableViewController
。
我试图让这个弹出窗口半透明,以便能够显示覆盖的 View 。除此之外,我想要一个带有默认箭头等的标准弹出 Controller 。
从 iOS 5 开始,可以使用 UIPopoverBackgroundView 定义自定义弹出框背景 View 。 . 但是,我正在努力正确设置背景。我用来设置背景 View 的代码如下所示。我想设置仅 alpha 值,并将其他属性设置为默认值。
此外,我还需要如何配置弹出框内显示的 TableView Controller 以使其 View (及其所有 subview ,文本除外)也具有透明度。
谢谢!
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;
}
最佳答案
试试这个 link
设置
#define DEFAULT_TINT_COLOR [UIColor blackColor];
到
#define DEFAULT_TINT_COLOR [UIColor clearColor];
关于ios - 如何使用 UIPopoverBackgroundView 在 iOS 6 中呈现透明弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15717147/