這裏我使用3.2.5sdk和4.2 IOS,IPhone應用問題
我創建viewbased應用程序並添加基於舔
UINavigationController *navigation = [[UINavigationController alloc]
initWithRootViewController:viewController];
[self.window addSubview:navigation.view];
現在我創建一個工具欄上的導航和該工具欄設置按鈕,一旦我rotrate我的模式從portrate TI景觀或反之亦然舔使用此代碼
- (BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
- (void)willRotateToInterfaceOrientation:
(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if (UIInterfaceOrientationIsPortrait(toInterfaceOrientation))
{
[toolbarview setFrame:CGRectMake(0, 979, 768, 45)];
NSLog(@"the frame size is %f,%f,%f,%f",toolbarview.frame.origin.x,
toolbarview.frame.origin.y,toolbarview.frame.size.width,
toolbarview.frame.size.height);
NSLog(@"This is protrait mode");
}
else
{
[toolbarview setFrame:CGRectMake(0, 723, 1024, 45)];
NSLog(@"the frame size is %f,%f,%f,%f",toolbarview.frame.origin.x,
toolbarview.frame.origin.y,toolbarview.frame.size.width,
toolbarview.frame.size.height);
NSLog(@"This is land mode");
}
其工作正常,但一旦從IM的viewController導航到另一個p年齡,然後我改變我的模式舔這個代碼在第二頁上。
- (BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)interfaceOrientation
{
// Overriden to allow any orientation.
if ((interfaceOrientation==UIInterfaceOrientationLandscapeLeft) ||
(interfaceOrientation==UIInterfaceOrientationLandscapeRight))
{
[viewController.toolbarview setFrame:CGRectMake(0, 723, 1024, 45)];
NSLog(@"the frame size is %f,%f,%f,%f",viewController.toolbarview.frame.origin.x,
viewController.toolbarview.frame.origin.y,
viewController.toolbarview.frame.size.width,
viewController.toolbarview.frame.size.height);
NSLog(@"this is the Landscape Mode in home");
}
else
{
[viewController.toolbarview setFrame:CGRectMake(0, 979, 768, 45)];
NSLog(@"the frame size is %f,%f,%f,%f",viewController.toolbarview.frame.origin.x,
viewController.toolbarview.frame.origin.y,
viewController.toolbarview.frame.size.width,
viewController.toolbarview.frame.size.height);
NSLog(@"this is the portrait mode in home");
}
return YES;
}
而根據第二頁模式,我想更改工具欄的位置,但它不工作。
,它看起來像一個iPad應用程序,而不是iPhone – 2011-01-28 09:58:41