的UIScrollView +的UIViewController + uiactionsheet

时间:2011-02-15 07:06:21

标签: iphone uiviewcontroller uiscrollview uiactionsheet

我根据以下教程Multiple Virtual Pages in a Scrollview创建了一个应用。 我添加了一个按钮,按下时会显示一个UIActionSheet。它在第一页上很好用,但是其他页面没有显示。我认为这是因为工作表显示在(0,0)所以我尝试使用视图的框架启动工作表。没有运气。

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];

任何人都知道这里发生了什么?我能做些什么来纠正这个问题?

1 个答案:

答案 0 :(得分:0)

尝试使用这些功能,而不是自己设置框架

  

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

并显示具有此功能的提醒

  

[popupQuery showInView:self.view];

祝你好运。