There are several things that are not clear in your code:
First, you are setting the text of text and detail labels. This belongs into cellForRowAtIndexPath
or some other method like configureCell
. However, selecting from a table view is caught via didSelectRowAtIndexPath
. Make sure you configure your cell in one method and react to selection in another.
Second, you are instantiating your view controller but not presenting it. You can either
- instantiate the view controller and present it via
presentViewController:animated:
or - link the detail view controller via a segue in storyboard. In this case, you do not need to instantiate it but simply call
performSegueWithIdentifier
. You configure your detail view inprepareForSegue
.