开发者

"Connect" UiTableView with NavigationController

I am rather new to ios programming and i tried to create a tabbar application with 4 tabs tab 1 and tab 2 are navigationcontrollers holding a UIView ... now i have a navigationbar, which i can access from my UIView classes.

I put a UITableView in the UIView-Class (with IB) and added a editbutton to the navig开发者_如何学编程ation bar:

self.navigationItem.leftBarButtonItem = self.editButtonItem;

Ok, this seems easy and okay, but how can i connect the "edit button" with the uitableview in my UIView Class. The Table is filled with data but when i push the edit button nothing happens ... i do not want to change the UIView class to UITableView because ther are some other UI Elements on the View.


I recommend having a read of the Table View Programming Guide for iOS (specifically the "Inserting and Deleting Rows in Editing Mode" section), as it covers everything you need and you'll learn a lot that'll stand you in good stead going forward.


Got it! The UIViewController gets the editing message .. just override it and set the editing mode of the table within:

-(void)setEditing:(BOOL)editing animated:(BOOL)animated {
    [super setEditing:editing animated:animated];
[self.myTableView setEditing:editing animated:animated];

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜