我是新來的iPhone開發者的細胞,的UILabel中的UITableView
我使用UITableView
,我想總6個標籤在我UITableView
3標籤上LHS和RHS
這裏3標籤的Cell
是我代碼片段,
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 180;
}
- (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];
CGRect frameL;
frameL.origin.x = 10;
frameL.origin.y = 10;
frameL.size.height = 50;
frameL.size.width = 200;
CGRect frameR;
frameR.origin.x = 200;
frameR.origin.y = 10;
frameR.size.height = 40;
frameR.size.width = 180;
UILabel *AlertNameLHS = [[UILabel alloc] initWithFrame:frameL];
AlertNameLHS.font=[UIFont systemFontOfSize:16.0];
AlertNameLHS.backgroundColor=[UIColor clearColor];
AlertNameLHS.textColor=[UIColor redColor];
[email protected]"Alert Name :";
[cell.contentView addSubview:AlertNameLHS];
frameL.origin.y += 60;
UILabel *AlertMonthLHS = [[UILabel alloc] initWithFrame:frameL];
AlertMonthLHS.font=[UIFont systemFontOfSize:16.0];
AlertMonthLHS.backgroundColor=[UIColor clearColor];
AlertMonthLHS.textColor=[UIColor redColor];
[email protected]"Alert Month :";
[cell.contentView addSubview:AlertMonthLHS];
frameL.origin.y += 120;
UILabel *DueOnLHS = [[UILabel alloc] initWithFrame:frameL];
DueOnLHS.font=[UIFont systemFontOfSize:16.0];
[email protected]"Due On :";
[cell.contentView addSubview:DueOnLHS];
AlertNameRHS = [[UILabel alloc] initWithFrame:frameR];
AlertNameRHS.backgroundColor=[UIColor greenColor];
AlertNameRHS.textColor=[UIColor redColor];
AlertNameRHS.textColor=[UIColor redColor];
AlertNameRHS.font=[UIFont systemFontOfSize:18.0];
[cell.contentView addSubview:AlertNameRHS];
frameL.origin.y += 80;
AlertMonthRHS = [[UILabel alloc] initWithFrame:frameR];
AlertMonthRHS.font=[UIFont systemFontOfSize:18.0];
[cell.contentView addSubview:AlertMonthRHS];
frameL.origin.y += 120;
DueOnRHS = [[UILabel alloc] initWithFrame:frameR];
DueOnRHS.font=[UIFont systemFontOfSize:18.0];
[cell.contentView addSubview:DueOnRHS];
}
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
AlertNameRHS.text = [Myarray objectAtIndex:indexPath.row];
return cell;
}
但我無法正常看到我的UILabel。
任何幫助將不勝感激。
編輯::
你的意思是在的tableView – 2012-07-12 08:48:06
創建6芯不要你看到了哪些標籤? – 2012-07-12 08:49:02
搜索創建自定義UITableViewCell – 2012-07-12 08:53:46