我試圖複製NSMutableArray
到另一個,但它並沒有顯示我什麼在UITableView
:複製NSMutableArray的另一個
NSMutableArray *objectsToAdd= [[NSMutableArray alloc] initWithObjects:@"one",@"two"];
NSMutableArray *myArray = [[NSMutableArray alloc] initWithObjects:objectsToAdd,nil];
NSMutableArray *list = [[NSMutableArray alloc] init];
[self.list addObjectsFromArray:myArray];
沒有顯示出來!哪裏不對?
它崩潰了我的應用程序,因爲我沒有零在我的NSMutableArray
如何添加零它? addobject:nil
不起作用崩潰的應用程序:
static NSString * DisclosureButtonCellIdentifier =
@"DisclosureButtonCellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:
DisclosureButtonCellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier: DisclosureButtonCellIdentifier]
autorelease];
}
NSUInteger row = [indexPath row];
NSString *rowString =nil;
rowString = [list objectAtIndex:row];
cell.textLabel.text = rowString;
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
[rowString release];
return cell;
爲何要顯示什麼?發佈您的cellForRowAtIndexPath:方法的代碼 – Morion 2010-01-13 14:08:00
更新如何添加nil到添加對象的NSMutableArray?它崩潰我的應用程序在cellForRowAtIndexPath – stefanosn 2010-01-13 15:05:05