开发者

Problems with two instances of one TableViewController

开发者 https://www.devze.com 2023-03-27 23:00 出处:网络
I have a application which uses two instances of one TableViewController in two different views. ViewA holds instance of ViewC

I have a application which uses two instances of one TableViewController in two different views.

ViewA holds instance of ViewC
ViewB holds instance of ViewC

When a manipula开发者_开发问答te ViewC from ViewA and switch to ViewBs instance of ViewC the manipulations done via ViewA seems to change ViewBs' instance of ViewC.

Isn't that strange, or is this how it's suppose to work?


It depends on whether the two separate instance of the TableViewController are using the same datastore/model to populate the table. If both are sharing the one model object (be it a datastore, array etc.) then when one manipulates that shared datastore the changes would be reflected in the other table view.


This is the best thing in in Objective-C. what you should do is that you should make 2 copy of that class, here is a nice link to make you understand the consept

0

精彩评论

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

关注公众号