Search code examples
iphoneiosuitableviewviewcell

How to link each UITableViewCell with another view


I'm new in iOS programming, and I want to do a simple thing. I saw several topics about my problem, but I don't understand why my code doesn't work...

  • I created an empty view called details.xib
  • I created an objective-C class, so I have two empty files details.h and details.m
  • In my main view called ViewController.xib, I have a tableView
  • In ViewController.m, I added on the top : #import "details.h"
  • In ViewController.m, I modified the didSelectRowAtIndexPath method like this :

    details *det = [[details alloc] init];
    [self.navigationController pushViewController:det animated:YES];
    

I obtain this avertissement : Incomptatible pointer types sending 'details *__strong' to parameter of type 'UIViewController *'

Sorry if my english is awkward, I'm french... Thanks for your help !


Solution

  • Check whether you are rooted the details.xib with class properly in file owner.

    Refer this image:

    enter image description here

    And make sure you Details view controller is a sub class of UIViewController if not, create a view controller as UIViewController sub class(While creating a view controller itself u will can choose. refer below image)

    enter image description here