我正在嘗試創建iOS
storyboard
,其中portrait
和landscape
爲多視圖。我所創造的一切故事板constraints
和autolayout
。如何使用Objective C根據設備方向更改UIView約束?
現在我的問題是肖像我需要顯示像下面的肖像圖像。那是我通過使用故事板約束完成的。
對於風景需要顯示First View (red)
和底部欄只有其他硬編碼隱藏的其他欄。但是我不知道如何將紅色屏幕的第一視圖全高度擴展到底部酒吧頂部。
注意:這是通用應用程序。
- (void) orientationChanged:(NSNotification *)note
{
UIDevice * device = note.object;
switch(device.orientation)
{
case UIDeviceOrientationPortrait:
/* start special animation */
NSLog(@"Portrait");
self.namelist_tableview.hidden = NO;// ORANGE VIEW
break;
case UIDeviceOrientationLandscapeRight:
/* start special animation */
NSLog(@"Landscape");
self.namelist_tableview.hidden = YES;// ORANGE VIEW
break;
case UIDeviceOrientationLandscapeLeft:
/* start special animation */
NSLog(@"Landscape");
self.namelist_tableview.hidden = YES;// ORANGE VIEW
break;
default:
break;
};
}
哇。及時給予幫助。謝謝你,夥計我做到了! –