Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Blog Reader iPhone App Viewing a Web Page Navigation Controller

Scott Fitsimones
Scott Fitsimones
2,609 Points

How is didSelectRowAtIndexPath: getting touch events? How is it connected to the Main.storyboard?

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;

I am accustomed to having to hook methods up with IBAction.

2 Answers

UITableViewController does all the magic and you only have to implement the correspondent UITableViewDelegate methods to respond to those events.

Denis Kiselev
Denis Kiselev
12,737 Points

UITableView controller have UIViewController as parent class, which in turn have UIResponder as (grand)parent class. So, each UIViewController have ability to receive touch event - this is due to design of iOS. Then, each view controller will call appropriate methods when receiving some touches on different area - like cell or header, or time bar (on top of screen), etc. Then it will forward this touch event to be handled in child classes by calling designated methods - this is all by design of framework.