开发者

creating a cell for selecting an item

开发者 https://www.devze.com 2023-04-11 06:01 出处:网络
so i want to achieve something like this: when clicking on this cell, there should pop a new tableview with the items availible, by clicking one of 开发者_运维知识库these items, it should go back a

so i want to achieve something like this:

creating a cell for selecting an item

when clicking on this cell, there should pop a new tableview with the items availible, by clicking one of 开发者_运维知识库these items, it should go back and update the cell. normal stuff i think.

but i'm not shure how to do it the best way. first i need to subclass a uitableview cell , because there is no default one for this, right? and the rest?

should i set an ivar to the new popped tableviewcontroller with the selected cell and update the content after an item was selected? but then i had to reload table data , don't i ? wouldn't this break my selection, the scrolled way and all this stuff? would be a bit weird while the navigation-controller goes back to this tableview.

please help me with some best practices for this.

thanks and please leave a comment if something is unclear.


That cell style is UITableViewCellStyleValue1.

I would write a custom delegate protocol that the parent controller implements so that the child controller can inform it when the user has made the selection. But you can also use a property on the child controller. Or use a notification.

To update the cell in the parent view controller, just call [tableView reloadRowsAtIndexPaths:withRowAnimation:]. No need to reload the entire table.

0

精彩评论

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