我的兩個代碼運行良好..但我想知道..誰更好... 和我使用哪個?stringWithFormat和UILabel中的多行文本
第一代碼.....
NSString *advance=[[NSString alloc]initWithFormat :@"Pay in Advance Rs %i",pro.s_advance ];
UILabel *label1 =[[UILabel alloc]initWithFrame:CGRectMake(10,5,200,40)];
label1.text=advance;
[cell.contentView addSubview:label1];
[label1 release];
[advance release];
和第二代碼是.....
UILabel *label1 =[[UILabel alloc]initWithFrame:CGRectMake(10,5,200,40)];
label1.text=[NSString stringWithFormat:@"Pay in Advance Rs %i",pro.s_advance ];
[cell.contentView addSubview:label1];
[label1 release];
@Nekto ...謝謝 – GauravBoss
我會推薦在iOS 5 SDK下編譯,它將爲您處理內存管理,然後您不必真正處理哪一個更好。 – Ziminji