문제

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 navigation 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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top