开发者

Swapping nsmutabledata

开发者 https://www.devze.com 2023-03-07 02:16 出处:网络
I have one UIViewController containing a UITableView. Along with this I have 3 buttons and 4 Mutablable arrays.

I have one UIViewController containing a UITableView. Along with this I have 3 buttons and 4 Mutablable arrays.

Array "prime" is the primary datasource for the table view.

When I hit button a , b or c I write

prime= a

开发者_开发技巧[table reloadData];

or

prime= b

[table reloadData];

The problem I have is that after say 2 button pushes prime is not equal to either a or b. It contents now contain the contents of a "and" b and it's contents will continue to accumulate after every assign.

How can I make 1 nsmutuablearray switch its contents to be that of another?

I know I can just remove all objects and then add more. I more wanted to know if its possible to make prime be a pointer to a b or c?


Try instead: prime = [a copy];

0

精彩评论

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

关注公众号