简体   繁体   English

如果调出UIActionSheet,如何使其中一个选项适合新视图?

[英]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.

相关问题 在iOS 7中,如何更改UIActionSheet中选项的颜色? - In iOS 7, how do I change the color of the options in my UIActionSheet? 短暂的超时后如何选择新的视图控制器? - How do I segue to a new view controller after a short timeout? 我怎样才能做到这一点? - How can I do this with one segue? 如何在另一个控制器下调出模态视图控制器? - How can I bring up a modal view controller under another one? 对于 swift iOS 应用程序开发人员,如何转到仅占屏幕一部分的视图? - For swift iOS app dev, how do I segue to a view that takes up part of the screen only? 如何使“全部查看”按钮通过segue到下一个ViewController显示数据? - How do I make a “View All” button display data via segue to the next ViewController? 如何在不使用segue的情况下将一些值从一个视图控制器传递给Swift 4中的UINavigationController? - How do I pass some value from one view controller to UINavigationController in swift 4 without using segue? 如何将引用从调用视图控制器传递给呈现有segue的引用? - How do I pass a reference from a calling view controller to one presented with a segue? 如何在标签栏控制器中从一个视图控制器切换到另一个视图控制器并保留标签栏? - How within a tab bar controller do I segue from one view controller to another and retain the tab bar? 如何在Swift的新视图中调用segue? - How can I call a segue in a new view in Swift?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM