2011-09-15 11 views
1

現在、私はポートレートモードで中央にUILableを配置します。AutorotateToInterfaceOrientationの中心を移動

UILabel* lbl=[[UILabel alloc] initWithFrame:CGRectMake(280, 10, 150, 45)]; 
[email protected]"3 out of 5 views"; 
lbl.font=[UIFont fontWithName:@"Arial" size:18]; 
lbl.textColor=[UIColor whiteColor]; 
lbl.backgroundColor=[UIColor clearColor]; 

[cell.contentView addSubview:lbl]; 

ランドスケープモードに変更すると、ランドスケープの中心にはなりません。ですから、私はautoresizingMaskを試してみましたが、うまくいきません。風景やポートレートモードでは常に中央にUILableを移動する方法

lbl.autoresizingMask=UIViewAutoresizingFlexibleLeftMargin; 

答えて

2

はそれを

[lbl setAutoresizingMask:UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin]; 
を手に入れました
関連する問題