1
我有一個表view.i想減少字體大小和截斷字符串的長度爲5個字符cell.detailTextLabel.text
.cud你們幫我。下面是代碼。如何減少字體大小和截斷文本標籤在ios tableview
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
//NSInteger SectionRows=[tableView1 numberOfRowsInSection:indexPath.section];
//NSInteger Row=indexPath.row;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
}
//cell.imageView.backgroundColor=[UIColor clearColor];
cell.selectionStyle=UITableViewCellSelectionStyleNone;
cell.textLabel.text=[listOfItems objectAtIndex:indexPath.row];
cell.textLabel.backgroundColor=[UIColor clearColor];
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
if (indexPath.row == 3)
{
[email protected]"Aktiviteter";
}
if (indexPath.row == 4)
{
cell.textLabel.textColor=[UIColor purpleColor];
[email protected]"Läs mer om Allegra";
}
if (indexPath.row == 5)
{
starImage.image = [UIImage imageNamed:@"add.png"];
[cell.contentView addSubview:starImage];
}
return cell;
}
這個回答解決問題了嗎? – Ilanchezhian 2012-02-06 07:25:09
感謝man dat工作.. – stephensam 2012-02-06 07:51:16