强制旋转iPhone界面
来源:互联网 发布:php pathinfo 开启 编辑:程序博客网 时间:2024/04/30 10:11
在现在的ios sdk中,我们一般通过UIApplication的setStatusBarOrientation:来进行View的强制旋转
(当然,还要配合- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation),
但是,setStatusBarOrientation并不一定马上会执行shouldAutorotateToInterfaceOrientation进行界面旋转,
这时,有个小技巧可以让界面马上旋转过来,那就是调用一下 UINavigationController的presentModalViewController:animated:
{
//为了马上旋转过来
UINavigationController* nav = [[GurgleAppDelegate getAppDelegate] navigationController];
UIViewController *controller = [[UIViewController alloc] init];
UINavigationController *parentController = [[UINavigationController alloc] initWithRootViewController:controller];
[nav presentModalViewController:parentController animated:NO];
[controller dismissModalViewControllerAnimated:NO];
[parentController release];
[controller release];
}
// Override to allow orientations other than the default portrait orientation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
return viewOrientation == interfaceOrientation;
}
注意:这样做导航栏会消失,但是可以通过自定义导航栏来显示导航的效果
- 强制旋转iPhone界面
- 强制iphone界面马上旋转
- 强制iphone界面马上旋转(转载)
- ios 强制某个界面旋转成横屏
- ios 强制某个界面旋转成横屏
- iPhone旋转
- iOS开发中控制屏幕旋转,个别界面强制横屏
- iOS强制旋转屏幕
- ios屏幕强制旋转
- 如何强制旋转屏幕
- iOS强制屏幕旋转
- 强制旋转一个UIViewController
- iOS屏幕强制旋转
- iOS 强制屏幕旋转
- iOS 强制旋转屏幕
- 强制设置语言 iphone
- iPhone强制关机
- iPhone、iPad强制关机
- ubuntu linux服务管理程序:sysv-rc-conf简介(转载)
- webIM配置(openfire+nginx)
- Http方法:Get请求与Post请求的区别
- Eclipse配置eclipse.ini
- 指针数组作函数参数
- 强制旋转iPhone界面
- JAVA开源项目
- openindiana下配置静态IP
- 清理web服务器缓存
- 在Visual Studio 2010[VC++]中使用ffmpeg类库
- Pydbg track api
- SVN trunk, branches and tags的使用方法
- 关于ip_free中的一些疑问
- 对于Nexus 7的合作 华硕和Google高层想说啥?