2012-01-31 1 views
0
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"Cell"; 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if (cell == nil) 
    { 
     cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellIdentifier] autorelease]; 
    } 

    timeLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 33)]; 
    dataLabel = [[UILabel alloc]initWithFrame:CGRectMake(105, 0, 320, 33)]; 
    timeLabel.backgroundColor = [UIColor clearColor]; 
    dataLabel.backgroundColor = [UIColor clearColor]; 
    dataLabel.textColor = [UIColor whiteColor]; 
    timeLabel.textColor = [UIColor whiteColor]; 
    [cell.contentView addSubview:timeLabel]; 
    [cell.contentView addSubview:dataLabel]; 

    if(indexPath.row == 0) 
    { 
     if([storedDataArray count]>0) 
     { 
      timeLabel.text = currenttime; 
      dataLabel.text = textView1.text; 
     } 
     return cell; //returns empty cell if there is no data in the data base 
    } 
    if(indexPath.row == 1) 
    { 
      timeLabel.text = currenttime; 
      dataLabel.text = textView2.text; 
     return cell; 
    } 

를 셀에 추가되는 라벨 타고을 통해 방지 할 수 있습니다. 내가 textLabel.text, DetailTextLabel.Text 및 정렬, 를 사용할 때 어떻게 테이블보기 이

  • 은 실제로는하지만 내가 원하는 위치에 표시됩니다.
  • 그래서 나는 자신의 레이블을 사용하려고했습니다.
  • 하지만 덮어 씁니다.
  • 우리는 (그럴 수는 없지만) possibl을 바꾸지 않았으므로 & 셀 텍스트 레이블의 프레임 크기 인 detailTextLabel에 원하는 프레임 크기의 레이블 2 개를 추가했습니다. 우리가 텍스트 뷰의 텍스트를 입력하고 테이블보기로 다시 돌아올 때

    • 하지만 .. 라벨은 덮어 얻을 ..

이 무엇을 ..

  • 입니다 내 텍스트 레이블
  • 의 프레임 크기를 고정하거나 레이블을 덮어 쓰지 않도록 다른 대체물이 있습니다.
+0

당신은 당신이 뭘 하려는지에 대한 자세한 내용을 설명 할 수있는 완벽하게

if (cell== nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"MenuNameCell" owner:self options:nil]; cell = [nib objectAtIndex:0]; NSLog(@"---------new cell agin"); } else { NSArray *arrayView = [cell.contentView subviews]; for (UIView *vTemp in arrayView) { [vTemp removeFromSuperview]; } NSLog(@"---No New Cell hiiii"); // Setting Tag To UIButton _checkButton = (UIButton *)[cell.contentView viewWithTag:indexPath.row]; _cancelButton = (UIButton *)[cell.contentView viewWithTag:indexPath.row]; } 

다른 파트를 추가 작동합니까? –

+0

가장 왼쪽에있는 textlabele을 detailTextlabel 옆에 표시해야합니다. 실제로 내가 textLabel.text, DetailTextLabel.Text 및 allignments를 사용할 때 .. 이 표시되지만 적절한 위치에 표시하고 싶습니다. 그래서 나는 자신의 레이블을 사용합니다 .. 하지만 그들은 쓰기가 끝났습니다. –

답변

0

사용이 코드에만