1. Remove statusbar.
Add uistatusbarhidin info. plist to set Boolean to yes.
2. Landscape Screen
Add uiinterfaceorientation in info. List to set uiinterfaceorientationlandscaperight.
3. Gravity sensing
Appdelegate inherits the uiaccelerometerdelegate protocol and implements
// 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 {}
In
-(Void) Applicationdidfinishlaunching :( uiapplication *) Application {
}
Add
// Configure and start Accelerometer
[[Uiaccelerometer sharedaccelerometer] setupdateinterval :(1.0/Kaccelerometerfrequency)];
[[Uiaccelerometer sharedaccelerometer] setdelegate:Self];
Gravity sensing can be realized.
4. automatic switch.
-(Bool) shouldautorotatetointerfaceorientation :( uiinterfaceorientation) interfaceorientation // supports Vertical Rotation
{
Return yes;
}
-(Void) willrotatetointerfaceorientation :( uiinterfaceorientation) tointerfaceorientation duration :( nstimeinterval) Duration // when rotation occurs
{
F (self. interfaceorientation = uiinterfaceorientationportrait | self. interfaceorientation = uideviceorientationportraitupsidedown)
{
// Vertical Steering
}
}
-(Void) didrotatefrominterfaceorientation :( uiinterfaceorientation) frominterfaceorientation // The rotation is completed.
{If (self. interfaceorientation = uiinterfaceorientationportrait | self. interfaceorientation = uideviceorientationportraitupsidedown)
{
// Currently in portrait Mode
}
}
Switching between landscape screens
-(Bool) Shouldautorotatetointerfaceorientation :(Uiinterfaceorientation)Interfaceorientation//Horizontal Vertical Rotation
{
If(Interfaceorientation=Uiinterfaceorientationlandscaperight)
{
Return Yes;
}
Else If(Interfaceorientation=Uiinterfaceorientationlandscapeleft)
{
Return Yes;
}
Return No;
}
//////////////////////////////////////// /////////////////////
The following has not been tested
Use gravity sensing to determine the direction of the phone and then set [uiapplication sharedapplication]. statusbarorientation = uiinterfaceorientationlandscaperight and uiinterfaceorientationportrait can be used to bring up a dialog box of landscape or portrait screen based on different phone directions. The keyboard containing the input box can also be automatically rotated in the dialog box.
//////////////////////////////////////// /////////////////////
5. Landscape Screen
Default-LandscapeLeft.png
Default-LandscapeRight.png
Default-Portrait.png
Default-PortraitUpsideDown.png