내 tableview에 있습니다. 첫 번째 이미지에서 처음 볼 때 볼 수없는 마지막 셀이 있습니다. 목록을 스크롤하면 두 번째 이미지에서 볼 수 있습니다. price 또는 my detailTextLabel이 오른쪽 정렬을 유지하지 못하는 새 행에 삽입됩니다. 여기 UITableViewCell UITableViewCellStyleValue1을 사용하여 아래쪽 셀의 detailTextLabel에 새 줄을 추가합니다.
image 2 http://img706.imageshack.us/img706/6007/iphoneerror2edited.jpg
image 1 http://img706.imageshack.us/img706/4496/iphoneerror1.jpg
- (UITableViewCell *)tableView:(UITableView *)ltableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [ltableView dequeueReusableCellWithIdentifier:CellIdentifier];
// Configure the cell.
NSUInteger indexRow = [indexPath row];
switch (indexRow) {
case 0:{
NSCharacterSet *set = [NSCharacterSet whitespaceCharacterSet];
NSString *description = [[currentData objectForKey:@"Description"] stringByTrimmingCharactersInSet:set];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.accessoryType = UITableViewCellAccessoryNone;
cellShift = 1;
if (![description isEqualToString:@""]) {
cell.textLabel.text = @"";
cell.detailTextLabel.text = description;
cell.detailTextLabel.numberOfLines = 2;
}
else {
cell.textLabel.text = @"";
cell.detailTextLabel.text = @"";
cell.detailTextLabel.numberOfLines = 0;
}
break;
}
default:{
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
}
NSDictionary *item = [tableData objectAtIndex:(indexRow-cellShift)];
NSString *name = [item objectForKey:@"Name"];
if ([name length] > MaxVendorsLength) {
name = [NSString stringWithFormat:@"%@ ...",[name substringToIndex:MaxVendorsLength]];
}
cell.textLabel.text = name;
cell.textLabel.minimumFontSize = 12;
NSString *priceString;
float price = [[item objectForKey:@"Price"] floatValue];
//NSLog(@"| %@ | : | %@ |",[item objectForKey:@"Name"], [item objectForKey:@"Price"]);
if (price != 0) {
priceString = [[NSString alloc] initWithFormat:@"$%.2f",price];
}
else {
priceString = [[NSString alloc] initWithString:@"--"];
}
cell.detailTextLabel.text = priceString;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
[priceString release];
break;
}
}
cell.textLabel.font = [UIFont boldSystemFontOfSize:15];
cell.textLabel.minimumFontSize = 14;
cell.detailTextLabel.font = [UIFont boldSystemFontOfSize:15];
cell.detailTextLabel.minimumFontSize = 14;
return cell;
}
을 감상 할 수있다 나는 이것에 도움을 얻기 위해 다른 것을 게시 할 필요가 있습니까 ???
대단히 감사합니다. – slim