我有一个包含工具栏的标准UIView的应用程序。我可以点击工具栏上的按钮来打开一个UIActionSheet,并且能够在那里显示我的文本,没有任何问题。我想要做的是让操作工单显示与我的项目不同的XIB。我已经在相关头文件和实现文件以及XIB中设置了一切,但我需要将点击操作工作表项目的操作链接到显示第二个视图。通过UIActionSheet切换视图
这是我到目前为止有:
- (void)actionSheet:(UIActionSheet *)sheet willDissmissWithButtonIndex:(NSInteger)buttonIndex {
if (buttonIndex != [sheet cancelButtonIndex]) {
if (buttonIndex == 0) {
ABC *secondview = [[ABC alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:secondview animated:YES];
}
if (buttonIndex == 1) {
DEF *secondview = [[DEF alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:secondview animated:YES];
}
if (buttonIndex == 2) {
GHI *secondview = [[GHI alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:secondview animated:YES];
}
[self dismissModalViewControllerAnimated:YES];
};
}
这将打开我的动作片,并显示所有正确的信息,但攻“ABC”,“DEF”或“GHI”仅关闭动作片就好像我点击取消按钮。我如何设置它以点击“ABC”,“DEF”或“GHI”在我的项目中打开不同的XIB?
这绝对是它的一部分。我做了更改,但应用程序的行为没有任何变化。它仍然无法正确地将操作表的水龙头路由到适当的视图。 – Jon 2012-01-15 00:46:46
好的,请参阅我上面的后续评论。 – 2012-01-15 01:15:52
您击中了头部:我的代表被设置为“无”。唯一的问题是 - 如果你不能说出来 - 我甚至不知道我在做什么。我查看了UI委托协议参考的Apple文档,但没有得到任何答案。你有没有机会进一步了解这个? – Jon 2012-01-15 05:10:30