iphone一些常识,去掉StatusBar,横屏,重力感应,主动切换反正,开机画面横屏,开机画面横屏。
来源:互联网 发布:淘宝网网页制作 编辑:程序博客网 时间:2024/06/07 05:12
http://www.cnblogs.com/APTX4869/archive/2011/02/24/1963527.html
1,去掉StatusBar
在info.plist添加UIStatusBarHidden设置Boolean,设置为YES.
2,横屏
持续在info.list中添加UIInterfaceOrientation 设置UIInterfaceOrientationLandscapeRight
3,重力感应
AppDelegate持续UIAccelerometerDelegate和谈,并实现
// Implement this method to get the lastest data 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)InterfaceOrientation //扭转 完成
{ 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
1,去掉StatusBar
在info.plist添加UIStatusBarHidden设置Boolean,设置为YES.
2,横屏
持续在info.list中添加UIInterfaceOrientation 设置UIInterfaceOrientationLandscapeRight
3,重力感应
AppDelegate持续UIAccelerometerDelegate和谈,并实现
// Implement this method to get the lastest data 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)InterfaceOrientation //扭转 完成
{ 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开机画面
- pthread_cleanup_push() pthread_cleanup_pop()
- (3)LUA程序设计-表达式与语句(expression & statement)
- 网络等待indicator的界面设置
- 告警“需要有 dll 接口由 class“xxx”的客户端使用”的解释
- wait, notify,notifyAll 小例子
- iphone一些常识,去掉StatusBar,横屏,重力感应,主动切换反正,开机画面横屏,开机画面横屏。
- 求100万以内素数的快捷方法
- 继承,组合设计模式,
- iPhone入门 - UIAlertView用法
- 警惕:23种榨干时间和精力的生命水蛭
- 科学与佛学
- 有关TI DSP的一些东西(整理一些网络资源及手册资料)--外设寄存器和CPU控制寄存器、数据类型、中断的使用
- zoj 3622 Magic Number (找规律+打表)
- android UI进阶之实现listview中checkbox的多选与记录