行动表不透明

时间:2009-10-20 14:38:20

标签: objective-c iphone cocoa-touch

由于某种原因,我的操作表的上半部分不是不透明的。我使用以下代码创建了视图和操作表:

//allocate the view
self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];

UIActionSheet *popupQuery = [[UIActionSheet alloc]
                             initWithTitle:nil
                             delegate:self
                             cancelButtonTitle:@"Cancel"
                             destructiveButtonTitle:nil
                             otherButtonTitles:@"Take a Picture",@"Select a Picture",nil];
popupQuery.delegate= self;
[popupQuery setOpaque:NO]; 
popupQuery.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[popupQuery showInView:self.tabBarController.view];
[popupQuery release];

然后我尝试通过使用下面的代码设置基础视图的不透明度来解决问题,但这也无济于事。

[self.view setBackgroundColor: color];
    UIColor *color = [[UIColor alloc] initWithRed:0.0 green:0.0 blue:0.0 alpha:0.5];

有什么建议吗?动作表的上半部分是深灰色。

2 个答案:

答案 0 :(得分:1)

你的意思是覆盖在实际按钮上方(屏幕的上半部分),就像在这张图片左侧的屏幕一样?

alt text http://developer.apple.com/iphone/library/documentation/userexperience/conceptual/mobilehig/art/ui_modalexamples.jpg

这不应该是不透明的。是否有某些特殊原因需要在您的应用程序中?如果你需要全面覆盖,那么modal view controller或者一个行动表可能是合适的吗?

答案 1 :(得分:1)

也许actionSheetStyle UIBarStyleBlackTranslucent可以提供帮助。