0
顯示重複值的表視圖。它叫顯示重複值的表視圖
-(UITableViewCell *)tableView:(UITableView *) cellForRowAtIndexPath:(NSIndexPath *)indexPath { }
方法兩次。爲什麼會發生?實際上表格視圖顯示數組值。
顯示重複值的表視圖。它叫顯示重複值的表視圖
-(UITableViewCell *)tableView:(UITableView *) cellForRowAtIndexPath:(NSIndexPath *)indexPath { }
方法兩次。爲什麼會發生?實際上表格視圖顯示數組值。
使用NSSet方法避免重複值。 NSArray而不是NSMutableArray。你可以使用
[values setArray:[[NSSet setWithArray:values] allObjects]];
或
NSMutableArray* uniqueValues = [[NSMutableArray alloc] init];
for(id e in Values)
{
if(![uniqueValues containsObject:e])
{
[uniqueValues addObject:e];
}
}
多少節,你呢?也許這是問題(例如有2個部分,因此每個部分調用一次方法) – Alladinian 2012-03-23 09:41:28
你有檢查你的表數組值嗎?如果不是那麼請先NSLog你的陣列。 – Hiren 2012-03-23 09:41:42
發佈一些更多的代碼 – Hiren 2012-03-23 09:42:08