Can I create a UITableViewController that inherits from a custom subclass of UIViewController?

Posted by prendio2 on Stack Overflow See other posts from Stack Overflow or by prendio2
Published on 2010-04-17T20:57:09Z Indexed on 2010/04/17 21:23 UTC
Read the original article Hit count: 303

I have common functionality that I need to access from all screens of my app: a right bar button item and associated action.

So as not to repeat the code I would like to set this up in a custom UIViewController and have all my view controllers inherit from it.

- (void)viewDidLoad {
    UIBarButtonItem *rightBarButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPlay target:self action:@selector(lightsCamera)];
    self.navigationItem.rightBarButtonItem = rightBarButton;
}

- (void)lightsCamera {
    …
}

However, I have a number of UITableViewControllers however and I would like to know if it is possible for them to inherit the functionality too?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa-touch