简体   繁体   中英

Extend UIViewController in UITableViewController IOS

i am using a view controller which contain common custom buttons. and i am using this class where i need those buttons . Like create a logout button in this class name logOutViewController and use this class where i need to show the logout button.

#import "logOutViewController.h"
@interface TableViewController : logOutViewController

This above code shows the logout button on the required viewcontroller.

This code works well in all view controller except UITaleViewController. because after importing logOutViewController.h if i replace the

#import "logOutViewController.h"
@interface TableViewController : UITableViewController

UITableViewController to logOutViewController then the default function in the UITableViewController class start giving error.

How should i suppose to get the functions of uiviewcontroller class uitableviewcontroller class.

You can work with UIViewController , if you say that it works fine with it, just use TableView delegate methods. For examle

@interface TableViewController : logOutViewController <UITableViewDelegate, UITableViewDataSource>

And use all needed methods. Don't forget to create your UITableView

@property (nonatomic, weak) IBOutlet UITableView *tableView

And connect it with manually added tableView in IB.

Hope it will help

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM