How do I get an individual table cell to take me to another ViewController

Hi,


I have 8 rows of data within a

Table View
that is nested within my
ViewController
, which is nested within a
UINavigationController
. I have become the delegate for the
UITableViewSource
and the
UITableViewDelegate
. I've implemented the the
UITableViewDataSource
methods but not the optional latter methods. I need to be able to navigate from a chosen cell to a new ViewController, but I can't work out how to do this.


The cells were created based on a .plist file using keys and values if this helps.


Many thanks

Posted on Apr 3, 2013 3:48 AM

Reply
5 replies

Apr 4, 2013 6:37 AM in response to Bogatyr

Thank you very much for the help, I will implement that method asap 🙂


As I am new to ios, I'm slowly getting to grips with its way of doing things, but I am still confused about what object or objects are geting passed into these methods that are delegated to my class?


Is it the actual graphical tableview thats in my .xib file? if so why are there 2 arguments? Does it mean that UITableView is the actual table as a whole, and the NSIndexPath are the cells?


Many thanks

Apr 4, 2013 8:10 AM in response to Daz1761

My suggestion is to follow one of the many excellent tutorials available on iOS programming. You can find them online via google. You can also learn iOS programming from books. The one I learned from is "Beginning iOS Development, Exploring the iOS SDK by LaMarche, Mark, et al". These tutorials will take you step by step through understanding the components used in iOS programs.


Note that UITableView is one of the most complex components with many, many options and settings. Understanding UITableView well is a requirement for good iOS programming so investing time into learning it well is a very good investment.


The reason there is a UITableView * parameter in the message is to identify which table the message is coming from -- your view controller could very well conceivably have more than one table in it (although most simple applications only have one, and so generally ignore that parameter. The indexPath is a compound structure that has fields section and row, which identifies the place within the table that was selected.

Apr 4, 2013 9:06 AM in response to Bogatyr

Thanks again, that is very informative indeed. Yes I kind of figured that the UITableView is one of the most complex and well used elements within ios, so its definiately worth investing my time into learning it as the app I'm trying to develop is very table based, but with audio involved also, but that can go on the back burner for now until I get to grips with the UITableView 🙂


Sounds like the indexPath is the one to explore further, as I still havent figured out where the property indexPath.row comes from, but if its a compound structure (can this be called a compound statement?), I'm kind of guessing that the row property comes from within the structure.


Thanks again for your time.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How do I get an individual table cell to take me to another ViewController

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.