简体   繁体   English

交换nsmutabledata

[英]Swapping nsmutabledata

I have one UIViewController containing a UITableView. 我有一个包含UITableView的UIViewController。 Along with this I have 3 buttons and 4 Mutablable arrays. 除此之外,我还有3个按钮和4个可变数组。

Array "prime" is the primary datasource for the table view. 数组“ prime”是表视图的主要数据源。

When I hit button a , b or c I write 当我按下按钮a,b或c时,我写

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. 我的问题是,在说2个按钮后,素数不等于a或b。 It contents now contain the contents of a "and" b and it's contents will continue to accumulate after every assign. 现在它的内容包含a和b的内容,并且每次分配后它的内容将继续累积。

How can I make 1 nsmutuablearray switch its contents to be that of another? 如何使1个nsmutuablearray切换其内容为另一个内容?

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 ab or c? 我更想知道是否有可能使质数成为ab或c的指针?

尝试尝试:prime = [副本];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM