开发者

Having UITableView edit button outside of the navigation bar

I have a UIViewController, and within that view i have UITableView added in IB

The UITableView displays the items from my array beautifully

I would like to be able to edit the items i.e delete them

BUT The UITableView does not have a navigation bar, and i am not using a nav开发者_运维知识库igation controller within this app i am just adding and removing views manually.

What i would like to do is place an "edit" button somewhere else within the view ... is this possible? and how might i go about this?


Put a button somewhere. In an action connected to it set TableView's editing property to YES - it should work fine. You also need to implement delegate's editingStyleForRowAtIndexPath method (return UITableViewCellEditingStyleDelete to allow to delete cells).


You could make one special cell (e.g. 1st row, 1st group) a button by implementing a adaequate didSelectRowAtIndexPath.

Or you could put buttons for editing/deleting in each cell (if single deletion/editing makes sense).

Or you could place the UIIableView on a super view wich also contains the button(s) as sub views.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜