1
下面是一個說明問題的片段。當手機處於橫向模式時,按鈕的頂角不可見。怎麼來的?這是一個不斷髮生在我身上的問題的實例。UINavigationController錯誤大小和錯位包含視圖
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIViewAutoresizing ar = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
[window makeKeyAndVisible];
window.rootViewController = self; //The delegate is a controller
UIViewController* vc = [[UIViewController new] autorelease];
nc = [[UINavigationController alloc] initWithRootViewController:vc];
CGRect r = self.view.frame;
r.origin = CGPointZero;
nc.view.frame = r;
[self.view addSubview:nc.view];
nc.view.autoresizingMask = ar;
UIView* b = [UIButton buttonWithType:UIButtonTypeRoundedRect];
r.size = vc.view.frame.size;
b.frame = r;
b.autoresizingMask = ar;
[vc.view addSubview:b];
return YES;
}
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return YES;
}
謝謝。
沒有幫助,對不起。 – Tiiba 2012-02-22 15:44:45