2014-02-28 37 views
0

我在橫向模式下有一個應用程序,現在我在appdelegate中添加了一個視圖,但是它顯示爲縱向模式。它是90度旋轉通過程序向橫向模式添加視圖

下面

中的appdelegate加入我的代碼

-(void)addProcessingView{ 
    UIView*container = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 100)] autorelease]; 
    container.backgroundColor = [UIColor grayColor]; 
    UILabel *label = [[[UILabel alloc] initWithFrame:CGRectMake(100, 0, 400, 100)] autorelease]; 

    [container addSubview:label]; 
    UIActivityIndicatorView *active = [[[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 100 , 100)] autorelease]; 
    [container addSubview:active]; 
    container.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin; 
    [self.window addSubview:container]; 
    container.center = self.window.center; 
} 

見圖片

enter image description here

回答

0

我認爲你必須更改視圖的幀大小。將下面的代碼替換成你的代碼。它會解決你的問題。

UIView*container = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 500)] autorelease]; 
+0

看到圖像添加 –

+0

通過保持我的框架,你得到了這個形象 – Romance

+0

沒有它由不是你改變原始代碼,索裏你的代碼也將無法正常工作 –

相關問題