私はiPhoneアプリの新しいプログラマだ...私は7つのラベルとテーブルビューの最初のセルで1つのImageViewのを持っている......複数のラベル... iphone
私はこのコードを書きますこの仕事は満足です...(スクロールするときに時間がかかるかもしれません)
教えてください...これはこの仕事をするかしないのですか? ...私に..the正しい方法を教えてくださいない場合は、電池を再利用している場合
...事前に
おかげ
- (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ファイル内)...そこには4つの異なるラベルがあります私の2番目のテーブルのセル.... – GauravBoss
...これを行うための正しい方法をお勧めすることができます...事前にお礼 – GauravBoss
私はあなたの問題を解決する必要がありますコードを掲載しました – Nekto