2011-02-15 69 views
0

我创建了一个基于以下教程Multiple Virtual Pages in a Scrollview的应用程序。 我添加了一个按钮,当按下时显示UIActionSheet。它在第一页显示效果很好,但其他页面不显示。我认为这是因为工作表显示在(0,0),所以我试图用视图的框架启动工作表。没有运气。uiscrollview + uiviewcontroller + uiactionsheet

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithFrame:self.view.frame]; 
[actionSheet setTitle:NSLocalizedString(@"Create Event", @"Create Event")]; 
[actionSheet setDelegate:self]; 
[actionSheet addButtonWithTitle:NSLocalizedString(@"Cancel", @"Cancel")]; 
[actionSheet addButtonWithTitle:NSLocalizedString(@"Save", @"Save")]; 
[actionSheet addButtonWithTitle:NSLocalizedString(@"Discard", @"Discard")]; 
[actionSheet setDestructiveButtonIndex:2];[actionSheet showInView:self.view]; 
[actionSheet release]; 

任何人都知道这是怎么回事?我能做些什么来纠正这个问题?

回答

0

尝试使用这些函数来代替,而不是通过自己设置框

UIActionSheet * popupQuery = [[UIActionSheet的alloc] initWithTitle:无 委托:自 cancelButtonTitle:@ “取消” destructiveButtonTitle:无 otherButtonTitles:@ “OK”,零]

,并显示具有这种功能的警报

[popupQuery showInView:self.view];

祝你好运。

+0

我试过这个没有运气。还有其他建议吗?有没有办法让我的viewcontroller'知道'他们在scoll视图中的位置? – RPD 2011-02-17 02:28:58

相关问题