[英]If I bring up a UIActionSheet, how do I make one of the options segue to a new view?
I really have no idea how to do this. 我真的不知道该怎么做。 I created the
UIActionSheet
, it comes up when I tap a button, but I want, upon a certain option being selected for the app to segue to a new view controller. 我创建了
UIActionSheet
,当我点击一个按钮时会出现它,但是我希望在为该应用选择了某个选项以将其选择到新的视图控制器时出现。
您在UIActionSheetDelegate方法中调用(当用户点击按钮时) [self performSegueWithIdentifyer:@"segue_id"];
Use Delegate
method of UIActionSheet
( – actionSheet:clickedButtonAtIndex: ) 使用
UIActionSheet
Delegate
方法( – actionSheet:clickedButtonAtIndex:)
#pragma mark - UIActionSheet Delegate Methods
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(buttonIndex == 0)
{
// code for Button 1
}
if(buttonIndex == 1)
{
// code for Button 2
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.