저는 아이폰 앱의 새로운 프로그래머입니다 ... 테이블보기의 첫 번째 셀에 7 개의 라벨과 1 개의 이미지 뷰가 있습니다 ......테이블 셀에 여러 라벨 ... iphone
이 코드는 그 .....이 작품은 만족 스럽습니다 ... (스크롤 할 때가 걸릴지도 모릅니다)
제발 말해주세요 ...이 일을 할 것인가 아닌가 .... ....? ... 나에게 용맹 한 올바른 방법을 알려 주시기 바랍니다없는 경우 셀을 재사용하는 경우
... 사전에
감사
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[NSString stringWithFormat:@"Cell %i",indexPath.section]];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:[NSString stringWithFormat:@"Cell %i",indexPath.section]] autorelease];
}
if(indexPath.row==0)
{
CGRect frame=CGRectMake(120,10, 80, 40);
UILabel *label1=[[UILabel alloc]init];
label1.frame=frame;
[email protected]"first label";
[cell.contentView addSubview:label1];
[label1 release];
CGRect frame2=CGRectMake(200,10, 80, 40);
UILabel *label2=[[UILabel alloc]init];
label2.frame=frame2;
[email protected]"second label";
[cell.contentView addSubview:label2];
[label2 release];
and so on.......
}
else if(indexPath.row==1)
{
//add four labels for this cell here......
}
return cell;
}
@Nekto ... 제안 주셔서 감사합니다 .... 나는 내 레이블을 정의하는 곳을 물어보고 싶습니다 ... (.h 파일) ... 네 가지 다른 레이블이 있습니다. 내 두 번째 테이블 셀 .... – GauravBoss
...이 일을위한 올바른 방법을 제안 할 수 ... 사전에 덕분에 – GauravBoss
귀하의 문제를 해결해야합니다 코드를 게시했습니다 – Nekto