当从选项卡栏显示时,如何使 UIActionSheet 半透明?
我正在使用一个非常简单的 UIActionSheet。代码如下:
UIActionSheet *editActionSheet = [[UIActionSheet alloc] initWithTitle:@"What do you like to do?"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Delete All Tasks"
otherButtonTitles:@"Arrange Task List", @"Mark All as Done", nil];
editActionSheet.actionSheetStyle = UIBarStyleBlackTranslucent;
[editActionSheet showFromTabBar:appDel.tabBarController.tabBar];
[editActionSheet release];
虽然我将操作表样式设置为半透明,但它始终显示为不透明。我不知道为什么?
谢谢你,
I am using a very simple UIActionSheet. Here is the code below:
UIActionSheet *editActionSheet = [[UIActionSheet alloc] initWithTitle:@"What do you like to do?"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Delete All Tasks"
otherButtonTitles:@"Arrange Task List", @"Mark All as Done", nil];
editActionSheet.actionSheetStyle = UIBarStyleBlackTranslucent;
[editActionSheet showFromTabBar:appDel.tabBarController.tabBar];
[editActionSheet release];
Although I set the action sheet style to translucent, it always appear opaque. I don't know why?
Thank you,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
XJones,我终于拿到了半透明的动作表!
首先,我隐藏选项卡栏,然后显示半透明操作表,然后立即显示选项卡栏。最终的代码将是这样的:
你知道吗,我现在知道为什么苹果希望这个操作表是不透明的。半透明操作表取消按钮与选定的栏项目(蓝色项目)有点冲突。并没有“那么”注意到,但我认为不透明的解决方案是更好的解决方案。
XJones, finally, I managed to get the translucent action sheet!.
First, I hide the tab bar, then I show the translucent action sheet and immediatley after that show the tab bar. The finally code would be like that:
You know what, I know now why Apple wanted this action sheet to be opaque. The translucent action sheet cancel button conflicts a little bit with the selected bar item (the blue one). It's not "so" noticed but I think an opaque one is a better solution.
我在创建的应用程序中所做的是使用
[editActionSheet showInView:appDel.tabBarController.superview];
而不是[editActionSheet showFromTabBar:appDel.tabBarController.tabBar];
。出于所有意图和目的完成相同的事情,并且比您的答案更容易实现。只是另一种方式。What I did in an app I'm creating was use
[editActionSheet showInView:appDel.tabBarController.superview];
instead of[editActionSheet showFromTabBar:appDel.tabBarController.tabBar];
. Accomplishes the same thing for all intents and purposes, and is much easier to implement than your answer. Just another way.当从选项卡栏显示操作表时,它将始终呈现选项卡栏的外观。在这种情况下你不能让它变得半透明。我还没有尝试子类化 UIActionSheet 并覆盖任何颜色或绘图属性,但这可能值得一试。
我建议更改问题的标题以反映实际问题(例如,当从选项卡栏显示时,如何使 UIActionSheet 半透明?)
When an action sheet is shown from a tab bar it will always take on the appearance of the tab bar. You can't make it translucent in this case. I haven't tried subclassing UIActionSheet and overriding any of the color or drawing properties but that might be worth a shot.
I'd recommend changing the title of your question to reflect the actual question (e.g. How can I make UIActionSheet translucent when shown from a tab bar?)