1
什麼是這行代碼的可變變體光盤:需要可變的變體光盤
self.dsSearch = [self.ds filteredArrayUsingPredicate:resultPredicate];
任何幫助表示讚賞:)
什麼是這行代碼的可變變體光盤:需要可變的變體光盤
self.dsSearch = [self.ds filteredArrayUsingPredicate:resultPredicate];
任何幫助表示讚賞:)
[NSArray filteredArrayUsingPredicate]
返回NSArray
所以將它做成一個NSMutableArray
使用:
self.dsSearch = [[NSMutableArray alloc] initWithArray:[self.ds filteredArrayUsingPredicate:resultPredicate]];
或者,如果你想要一個自動釋放的對象,使用方法:
self.dsSearch = [NSMutableArray arrayWithArray:[self.ds filteredArrayUsingPredicate:resultPredicate]];
謝謝,但它給了我一個ARC問題:沒有已知的類選擇器的方法'initWithArray:' – James 2012-07-06 12:35:53
最後一個工作謝謝! – James 2012-07-06 12:37:52
@詹姆斯我糾正了我的答案;我忘了'alloc'。 – trojanfoe 2012-07-06 12:38:02