uistoryboardsegue

How to get reference to UIPopoverController when using adaptive segue?

[亡魂溺海] 提交于 2019-12-03 05:19:52
In my iOS 7 app, I detected if a segue was a popover via this check in prepareForSegue : if ([segue isKindOfClass:[UIStoryboardPopoverSegue class]]) But now that I am using adaptive segues, the Present as Popover segue is no longer returning true in the above check. This is because segue is no longer a UIStoryboardPopoverSegue , instead it is a UIStoryboardPopoverPresentationSegue . However, one cannot simply add the Presentation word because that's not defined. What is the appropriate way to detect when the segue is a popover from an adaptive segue , as opposed to a full screen modal

Storyboard Segue Identifier naming conventions

我与影子孤独终老i 提交于 2019-12-03 03:28:00
问题 I'm building a large storyboard and I was wondering if anyone has come up with helpful naming conventions for segue identifiers . It looks like Apple just uses 'ShowX' in their examples where X is the name of the view it is showing. So far I prefer to use 'PushX' or 'ModalX' to keep track of which type of transition it is. Anyone have any other tricks or tips? 回答1: There is no correct answer for this question. It depends on taste. I mitigate for readability. Don't be shy to give a long name

Unwind Segue for UINavigationController

时光毁灭记忆、已成空白 提交于 2019-12-03 03:22:02
I have a simple UINavigationController which pushes a UIViewController onto the stack via a custom segue. I then implemented an IBAction on the first UIViewController to perform an unwind action and I implement segueForUnwindingToViewController. Unfortunately, the segueForUnwindingToViewController is not being called (I did confirm that canPerformUnwindSegue is being called on the first VC). I have not seen any simple examples of this behavior. Can anyone please help? Thanks. Here's the code from the root view controller of the NavigationController. - (IBAction) unwindFromSegue:

How unwindForSegue:towardsViewController: works?

♀尐吖头ヾ 提交于 2019-12-03 00:24:20
In my simple app, I have created some controllers with basic segues between them: Yellow controller -> BlueController -> GreenController -> OrangeController . Every of them has its own custom class. From OrangeController I created unwindSegue to my YellowController . It is ok. Within every class I put: override func unwindForSegue(unwindSegue: UIStoryboardSegue, towardsViewController subsequentVC: UIViewController) { print(unwindSegue) print(subsequentVC) } But it was not called at all. Why? What demo should I prepare to test this functionality? The same is with: func

performSegueWithIdentifier in swift [closed]

若如初见. 提交于 2019-12-02 23:45:28
Closed . This question needs details or clarity. It is not currently accepting answers. Learn more . Want to improve this question? Add details and clarify the problem by editing this post . If I have this Objective C code: [self performSegueWithIdentifier:@"push" sender:self]; and - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if([segue.identifier isEqualToString:@"push"]) { } What is the Swift equivalent? self.performSegueWithIdentifier("push", sender: self) override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) { if segue.identifier == "push" {

How to pass data to another controller on dismiss ViewController?

安稳与你 提交于 2019-12-02 21:09:06
I want to pass my data from one ViewController to another VC on VC dismiss. Is it possible? I've tried the next method and no success: On button click: self.dismiss(animated: true) { let storyboard = UIStoryboard(name: "Main", bundle: nil) let controller = storyboard.instantiateViewController(withIdentifier: "EditViewController") as! EditViewController controller.segueArray = [values] } when EditViewController appears again, my segueArray is nil there. How can I pass my data from my ViewController to the EditViewController on dismiss? the_legend_27 The best way to pass data back to the

Slowing Down Transition of Push Segue

流过昼夜 提交于 2019-12-02 20:48:05
问题 I was wondering if there is a way to slow down 'push segue & back' like Tinder & Snapchat does. It's like normal segue but it's somehow transiting slowly. I normally handle push segues with setting up a Push notification on Storyboard and programatically calling the segue (clicked on NavBarItem and push segued to new UIViewController) : func settingsTapped() { performSegueWithIdentifier("NewsToSettings", sender: nil) } It there a way to enable slowing down segue globally for the whole app? or

Why not just set initial view controller for login screen like this?

家住魔仙堡 提交于 2019-12-02 20:44:04
问题 I've already read this and this questions. But I didn't understand why the code below is not enough. This just works. Do I need an else statement to set rootViewController for LoginViewController ? Isn't it already set by Storyboard? func application(application: UIApplication, willFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool { if Settings.loggedIn { let mainStoryboard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle()) let mainViewController =

Errors while using shouldPerformSegue(withIdentifier, sender) method in swift4

坚强是说给别人听的谎言 提交于 2019-12-02 17:20:08
问题 What I'm trying to do: checking a condition, if the condition is true, perform segue as normal. If condition is false, call the shouldPerformSegue method and return false to cancel the segue. How I'm trying to do this: func buttonTapped{ if(condition is true){ // Perform actions // Perform segue as normal } else{ shouldPerformSegue(withIdentifier "mySegueIdentifier", sender: self){ return false } } } Errors I am receiving: extra argument in call. I removed the sender parameter to try and get

Storyboard Segue Identifier naming conventions

泪湿孤枕 提交于 2019-12-02 17:00:28
I'm building a large storyboard and I was wondering if anyone has come up with helpful naming conventions for segue identifiers . It looks like Apple just uses 'ShowX' in their examples where X is the name of the view it is showing. So far I prefer to use 'PushX' or 'ModalX' to keep track of which type of transition it is. Anyone have any other tricks or tips? There is no correct answer for this question. It depends on taste. I mitigate for readability. Don't be shy to give a long name for your segue identifier; give long and expressive names because Objective-C is a very verbose language