테이블 뷰를 만들고 uitableviewcell에 두 개의 uitextview를 추가하면 작동하지만 데이터로드시 전체 데이터가 표시되지 않습니다. 테이블 뷰를 스크롤하면 데이터가 셀에 표시됩니다.내가 클릭 할 때 uitableview가로드되지 않습니다.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier ];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
RSSEntry *entry = [_allEntries objectAtIndex:indexPath.row];
NSString *articleDateString = [dateFormatter stringFromDate:entry.articleDate];
txtView1 = [[UITextView alloc]initWithFrame:CGRectMake(0, 10, 320,100)];
txtView1.text =entry.articleTitle;
txtView1.editable = NO;
txtView1.font = [UIFont systemFontOfSize:20];
txtView1.textColor = [UIColor blackColor];
txtView1.delegate = self;
txtView1.textAlignment = UITextAlignmentLeft;
txtView1.scrollEnabled = NO;
int a= entry.articleSummary.length;
if(a < 100)
{
txtView2 = [[UITextView alloc]initWithFrame:CGRectMake(0, 70, 320, 100)];
}
else if(a <200)
{
txtView2 = [[UITextView alloc]initWithFrame:CGRectMake(0, 70, 320, 300)];
}
else
{
txtView2 = [[UITextView alloc]initWithFrame:CGRectMake(0, 70, 320, 400)];
}
txtView2.text = entry.articleSummary;
txtView2.editable = NO;
txtView2.font = [UIFont systemFontOfSize:16];
txtView2.textColor = [UIColor blackColor];
txtView2.delegate = self;
txtView2.textAlignment = UITextAlignmentLeft;
[cell.contentView addSubview:txtView1];
[cell.contentView addSubview:txtView2];
return cell;
}
당신이에 코드를 붙여 질문을 선택하고 "코드"버튼 (형식 표시 줄에서'{}'모양)을 사용하면이 코드 블록을 더 읽기 쉽게 만들어줍니다. :) –