0
在窗口屏幕方向正常工作時,我在窗口方向添加子視圖它不適用於只子視圖。我在改變方向時更改子視圖CGRectMake。窗口不更新子視圖CGRect當更改方向
self.myviewctrl = [[MYViewController alloc] initWithNibName:@"MYViewController" bundle:nil];
if (InterfaceOrientation==LandScape) {
self.myviewctrl.view.frame = CGRectMake(0, 0, 568, 320);
self.myviewcrl.anothersubview.frame = CGRectMake(430, 0,50,320);
} else{
self.myviewctrl.view.frame = CGRectMake(0, 0, 320, 480);
self.myviewcrl.anothersubview.frame = CGRectMake(260, 0,60,411);
}
self.window = [UIApplication sharedApplication].keyWindow;
if (!self.window) {
self.window = [[UIApplication sharedApplication].windows objectAtIndex:0];
}
[[[self.window subviews] objectAtIndex:0] addSubview:self.myviewctrl.view];
我沒有得到那個代碼。什麼是InterfaceOrientation和whats Landscape –
如果UIView是橫向意味着執行self.myviewctrl.view.frame = CGRectMake(0,0,568,320); self.myviewcrl.anothersubview.frame = CGRectMake(430,0,50,320);否則執行別的標準.. – jeyachandran
那不幫助;)我提到的價值從哪裏來的 –