Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

Storyboard and tableView

gbergamogbergamo Posts: 107Registered Users
Hi everyone!
I have a doubt here!
In my View I have a UITableView, 4 sessions and 1 cell in each session, ok! For each cell I want to specify what view controller I want to go.

Example
in session 0 cell 0 - I want to go to DetailViewController
in session 1 cell 0 - I want to go to HelpViewController

How can I do it?

thanks!
Post edited by gbergamo on
Vai de Que? - Car supplies Util - Download

iJob - Job search (Br) - Download

Replies

  • Duncan CDuncan C Posts: 8,024Tutorial Authors, Registered Users
    gbergamo;400701 said:
    Hi everyone!
    I have a doubt here!
    In my View I have a UITableView, 4 sessions and 1 cell in each session, ok! For each cell I want to specify what view controller I want to go.

    Example
    in session 0 cell 0 - I want to go to DetailViewController
    in session 1 cell 0 - I want to go to HelpViewController

    How can I do it?

    thanks!
    When you say "session," do you really mean section? Table views are in sections.

    You need to implement the tableView:didSelectRowAtIndexPath: table view delegate method. In that method, use the indexPath parameter to figure out which cell the user tapped. Then you can push a new view controller (if you are using a navigation controller) or invoke a segue if not.

    Since this sounds like a master/detail arrangement, it probably makes sense to put the view controller that contains your table view into a navigation controller, and move to your DetailViewController and HelpViewController with pushViewController:animated:. That way, you'll get a back button "for free", and will automatically return to the view controller with the table view when the user is done.
    Regards,

    Duncan C
    WareTo

    mug

    Animated GIF created with Face Dancer, available for free in the app store.
  • gbergamogbergamo Posts: 107Registered Users
    Duncan C;400703 said:
    When you say "session," do you really mean section? Table views are in sections.

    You need to implement the tableView:didSelectRowAtIndexPath: table view delegate method. In that method, use the indexPath parameter to figure out which cell the user tapped. Then you can push a new view controller (if you are using a navigation controller) or invoke a segue if not.

    Since this sounds like a master/detail arrangement, it probably makes sense to put the view controller that contains your table view into a navigation controller, and move to your DetailViewController and HelpViewController with pushViewController:animated:. That way, you'll get a back button "for free", and will automatically return to the view controller with the table view when the user is done.
    Sorry! I write it wrong, I wanna said section.
    Ok, so I have use the event tableView:didSelectRowAtIndexPath and depends the IndexPath I want, invoke the Segue, but how can I invoke a segue?

    I did that so simple with navigation controller our without storyboard. lol

    I was pushing the controller ABPeoplePickerNavigationController, and I was getting an error. Ok it works well when I push a "normal" controller, but how can I say that view (in storyboard) is the view of controller that I call?

    thanks
    Vai de Que? - Car supplies Util - Download

    iJob - Job search (Br) - Download
  • Duncan CDuncan C Posts: 8,024Tutorial Authors, Registered Users
    gbergamo;400728 said:
    Sorry! I write it wrong, I wanna said section.
    Ok, so I have use the event tableView:didSelectRowAtIndexPath and depends the IndexPath I want, invoke the Segue, but how can I invoke a segue?

    I did that so simple with navigation controller our without storyboard. lol

    I was pushing the controller ABPeoplePickerNavigationController, and I was getting an error. Ok it works well when I push a "normal" controller, but how can I say that view (in storyboard) is the view of controller that I call?

    thanks
    For your application, I would suggest using a navigation controller, not segues. That way you can push a detail controller, the user can manipulate the content, then pop that view controller and go back to the table view.

    You can save your navigation controller and all your other view controllers in your storyboard. Just use instantiateViewControllerWithIdentifier: when you want to create a new view controller, and use the resulting view controller in a call to the UINavigationController method pushViewController:animated:
    Regards,

    Duncan C
    WareTo

    mug

    Animated GIF created with Face Dancer, available for free in the app store.
Sign In or Register to comment.