iphone去掉StatusBar,横屏,重力感应,自动切换横竖,开机画面横屏,开机画面横屏。
来源:互联网 发布:ocr身份证识别 源码 编辑:程序博客网 时间:2024/06/06 18:47
1,去掉StatusBar
在info.plist添加UIStatusBarHidden设置Boolean,设置为YES.
2,横屏
继续在info.list中添加UIInterfaceOrientation 设置UIInterfaceOrientationLandscapeRight
在info.plist添加UIStatusBarHidden设置Boolean,设置为YES.
2,横屏
继续在info.list中添加UIInterfaceOrientation 设置UIInterfaceOrientationLandscapeRight
xcode 4.3.2中为Inital interface orientation 设置为Landscape (right home button)
当然你输入上面的,xcode也会为你纠正,所以两种都可以!
3,重力感应
AppDelegate继承UIAccelerometerDelegate协议,并实现
// Implement this method to get the lastest data from the accelerometer
- (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration {
//Use a basic low-pass filter to only keep the gravity in the accelerometer values{}
在
- (void)applicationDidFinishLaunching:(UIApplication *)application {
}
添加
//Configure and start accelerometer
[[UIAccelerometer sharedAccelerometer] setUpdateInterval:(1.0 / kAccelerometerFrequency)];
[[UIAccelerometer sharedAccelerometer] setDelegate:self];
就可以实现重力感应
4,自动切换横竖。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation //支持横 竖转动
{
return YES;
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration //当发生旋转 时
{
f(self.interfaceOrientation==UIInterfaceOrientationPortrait||self.interfaceOrientation==UIDeviceOrientationPortraitUpsideDown)
{
//横 转向 竖
}
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation //旋转 完成
{ if(self.interfaceOrientation==UIInterfaceOrientationPortrait||self.interfaceOrientation==UIDeviceOrientationPortraitUpsideDown)
{
//当前是在竖屏模式
}
}
横屏之间切换
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation //支持横 竖转动
{
if (interfaceOrientation == UIInterfaceOrientationLandscapeRight )
{
return YES;
}
else if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft)
{
return YES;
}
return NO;
}
/////////////////////////////////////////////////////////////
以下未经过测试
使用重力感应,判断手机的方向,然后设定[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight,以及UIInterfaceOrientationPortrait,就可以做到根据不同的手机方向弹出横屏还是竖屏的对话框了,包括对话框上包含输入框的键盘也可以自动旋转了
/////////////////////////////////////////////////////////////
5,开机画面横屏
Default-LandscapeLeft.png
Default-LandscapeRight.png
Default-Portrait.png
Default-PortraitUpsideDown.png
3,重力感应
AppDelegate继承UIAccelerometerDelegate协议,并实现
// Implement this method to get the lastest data from the accelerometer
- (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration {
//Use a basic low-pass filter to only keep the gravity in the accelerometer values{}
在
- (void)applicationDidFinishLaunching:(UIApplication *)application {
}
添加
//Configure and start accelerometer
[[UIAccelerometer sharedAccelerometer] setUpdateInterval:(1.0 / kAccelerometerFrequency)];
[[UIAccelerometer sharedAccelerometer] setDelegate:self];
就可以实现重力感应
4,自动切换横竖。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation //支持横 竖转动
{
return YES;
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration //当发生旋转 时
{
f(self.interfaceOrientation==UIInterfaceOrientationPortrait||self.interfaceOrientation==UIDeviceOrientationPortraitUpsideDown)
{
//横 转向 竖
}
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation //旋转 完成
{ if(self.interfaceOrientation==UIInterfaceOrientationPortrait||self.interfaceOrientation==UIDeviceOrientationPortraitUpsideDown)
{
//当前是在竖屏模式
}
}
横屏之间切换
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation //支持横 竖转动
{
if (interfaceOrientation == UIInterfaceOrientationLandscapeRight )
{
return YES;
}
else if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft)
{
return YES;
}
return NO;
}
/////////////////////////////////////////////////////////////
以下未经过测试
使用重力感应,判断手机的方向,然后设定[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight,以及UIInterfaceOrientationPortrait,就可以做到根据不同的手机方向弹出横屏还是竖屏的对话框了,包括对话框上包含输入框的键盘也可以自动旋转了
/////////////////////////////////////////////////////////////
5,开机画面横屏
Default-LandscapeLeft.png
Default-LandscapeRight.png
Default-Portrait.png
Default-PortraitUpsideDown.png
- iphone一些知识,去掉StatusBar,横屏,重力感应,自动切换横竖,开机画面横屏,开机画面横屏。
- iphone去掉StatusBar,横屏,重力感应,自动切换横竖,开机画面横屏,开机画面横屏。
- iphone一些常识,去掉StatusBar,横屏,重力感应,主动切换反正,开机画面横屏,开机画面横屏。
- 如何去掉、修改品牌机的开机画面
- 修改Android三屏开机画面
- cocos2dx 手机根据重力感应切换横屏
- 修改windows开机画面
- 替换开机画面
- 开机画面定制
- Android 开机画面
- 修改Android开机画面
- android开机画面
- 修改Android开机画面
- 修改Android开机画面
- 找回开机画面
- 修改Android开机画面
- wince开机画面
- 修改Android开机画面
- jQuery学习笔录6(动画)
- 从一生的角度看程序员的学习和发展
- js call 和 apply 的区别
- 35_hashcode解释
- Android开发中,sina的OAuth授权问题:(二)OAuth1.0授权的实现
- iphone去掉StatusBar,横屏,重力感应,自动切换横竖,开机画面横屏,开机画面横屏。
- 标题:NOR型flash与NAND型flash的区别
- 转换流和字节流
- 百度和谷歌优化区别
- 软件工程师在外企学什么?
- Spring总结及不同版本间的区别以及 Struts1.2+Spring1.2+Hibernate3.1的整合
- 让C++发射信号(emit)来触发QT槽以刷新进度条
- repeater 嵌套 textbox 赋值后提示 服务器标记的格式不正确。
- Android开发中,sina的OAuth授权问题:(三)OAuth2.0授权的实现