2012-10-30 130 views
1

我想的UILabel相對於屏幕分辨率(iPhone v的iPad)的位置,以使的UILabel不閃屏圖形在啓動干擾。當該應用程序只有iPhone時,標籤的位置正確。一旦應用程序通用,標籤干擾iPad上的圖像(當然)位置的UILabel的面積相對於屏幕分辨率

我正在使用下面的方法,它工作正常,但它不是非常有前瞻性的思考新設備和/或新屏幕分辨率。

任何人都可以建議一個更有效的方式來顯示UILabel「正在連接到服務器...」區域內的紅色附加圖像在下面的鏈接(我沒有身份驗證發佈圖像在這裏呢)?

UILabel *loadingLabel; 

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) 
{ 
    loadingLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 350, self.window.frame.size.width, 20)]; 
} 
else 
{ 
    loadingLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 700, self.window.frame.size.width, 20)]; 

} 
loadingLabel.text = @" Connecting to Server..."; 
loadingLabel.textAlignment = UITextAlignmentCenter; 
loadingLabel.textColor = [UIColor whiteColor]; 
loadingLabel.backgroundColor = [UIColor clearColor]; 

Splash Screen

回答

0

可以使用autoresizingMask屬性來完成它。 設置標籤上的origin.y是self.window.bounds.size.height - 200左右。然後設置autoresizingMaskUIViewAutoresizingMakFlexibleBottomMargin