Gav*_*vin 4 iphone uitableview
如果源存在,则不会显示detailTextLabel.但是相应地显示了textLable.text.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"favouriteListArray"] != nil) {
NSArray *listArray = [NSArray arrayWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:@"favouriteListArray"]];
NSLog(@"listArray:%@", listArray);
NSDictionary *listDic = [listArray objectAtIndex:indexPath.row];
NSLog(@"listDic:%@", listDic);
cell.textLabel.text = [listDic objectForKey:@"Description"];
cell.detailTextLabel.text = [listDic objectForKey:@"Address"];
}
return cell;
}
Run Code Online (Sandbox Code Playgroud)
listDic的NSLog
listDic:{
Address = myAddress;
Description = myDescription;
}
Run Code Online (Sandbox Code Playgroud)
jus*_*ssi 10
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
Run Code Online (Sandbox Code Playgroud)
您需要使用initWithStyle:UITableViewCellStyleSubtitle
| 归档时间: |
|
| 查看次数: |
3070 次 |
| 最近记录: |