Tagged: Segue Toggle Comment Threads | Keyboard Shortcuts

  • Jay Versluis 4:32 pm on July 13, 2012 Permalink | Reply
    Tags: Push, Segue, , UITabBarController,   

    Categories: iOS ( 222 )

    How to share data between Navigation Controllers 

    The Root Navigation Controller can serve as a data model. Each View Controller connected to the Navigation Controller via push segue can access its properties like so:

    ((MyNavController *)self.parentViewController).mySourceProperty
    

    Here’s an example. MyNavController is the class for the Navigation Controller. This snipped is called from any View Controller in sequence and assumes we have an integer myNumber which is increased by one:

    ((MyNavController *)self.parentViewController).myNumber++;
    

    The same principle works for Tab Bar Controllers too.





     
  • Jay Versluis 10:11 am on July 9, 2012 Permalink | Reply
    Tags: Modal, Segue,   

    Categories: iOS ( 222 )

    How to trigger a Modal Segue 

    Once you’ve connected two View Controllers via a Segue in the storyboard you need to give it an identifier so we can call it in code like so:

    [self performSegueWithIdentifier:@"showDetail" sender:self];
    

    Dismiss it via an action like this:

    [self dismissViewControllerAnimated:YES completion:nil];
    




     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel