我很抱歉問這個疑問。UITableview文本對齊方式在iPhone中不起作用
我創建了一個表格視圖單元格,並嘗試將它與中心對齊。但是這沒有做任何事情。只需在左邊對齊即可。
這是我使用的代碼。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
if(indexPath.section == 0){
SDSCaseListCustomCell *customCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
// if (customCell == nil)
{
NSArray *cells =[[NSBundle mainBundle] loadNibNamed:@"SDSCaseListCustomCell" owner:nil options:nil];
for (UIView *view in cells)
{
if([view isKindOfClass:[UITableViewCell class]])
{
customCell = (SDSCaseListCustomCell*)view;
}
}
}
SDSCase *cases = [caseList objectAtIndex:indexPath.row];
customCell.doctor.text = cases.referredDoctor;
customCell.hospital.text = cases.hospital;
//customCell.time.text = cases.referredDoctor;
customCell.caseId.text =cases.caseId;
return customCell;
}
else
{
UITableViewCell *loadMore = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (loadMore == nil)
{
loadMore = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
loadMore.textLabel.text = @"loadMore";
loadMore.textLabel.textAlignment = UITextAlignmentCenter;
return loadMore;
}
}
任何人都可以請幫我,我哪裏出錯了。
感謝advace。
我可以提供不同的代碼來設置tableview中的tableview單元嗎? – vishiphone