2011-05-30 75 views
1

我在我的应用程序中添加了一个操作表。我的应用是基于标签栏的应用。 我已经以这种方式操作表警告?

actionSheet = [[UIActionSheet alloc] initWithTitle:nil 
           delegate:self 
           cancelButtonTitle:@"Cancel" 
           destructiveButtonTitle:nil 
           otherButtonTitles:@"Take photo",@"Use existing photo",nil]; 
actionSheet.actionSheetStyle = UIBarStyleBlackTranslucent; 
[actionSheet showFromTabBar:self.view]; 

添加它。但是它显示警告:enter image description here

我如何可以将其删除。与此同时,我在显示操作表的标签中。

+0

如果你想从标签栏显示它,那么你必须通过标签栏引用,而不是UIView(self.view)。因此它说不兼容。 – 2011-05-30 08:18:57

+0

我该如何做到这一点? – 2011-05-30 08:30:06

回答

0

如果您使用的TabBar控制器,然后使用类似这样的

[actionSheet showFromTabBar:(UITabBar *)[appDelegate.tabBarController view]]; 
+0

Thx。现在它为我工作。 – 2011-05-30 08:54:38

1

如果您在选项卡中,是不是应该是[actionSheet showFromTabBar:self.tabBarController.tabBar];

+0

你可能更具体.....? – 2011-05-30 08:31:05

+0

你能告诉我你从哪里调用这段代码吗?视图控制器?如果是这样,你是否使用带有UITabBar对象的标签栏控制器或视图控制器? – 2011-05-30 08:33:24

+0

在应用程序委托类中使用tabbar控制器。并在标签栏1中使用此代码。 – 2011-05-30 08:38:00

2
[actionSheet showFromTabBar:self.tabBarController.tabBar]; 

试试这个,它可以帮助你。

+1

Thx coti。现在它为我工作。 – 2011-05-30 08:52:21