if([[Uidevice Currentdevice] Respondstoselector: @selector (setorientation:)]) {SEL selector= Nsselectorfromstring (@"setorientation:"); if(Uideviceorientationislandscape ([[[Uidevice Currentdevice] orientation]) {nsinvocation*invocation =[Nsinvocation Invocationwithmethodsignature:[uidevice instancemethodsignatureforselector:selector]; [Invocation setselector:selector]; [Invocation Settarget:[uidevice Currentdevice]; intval = uiinterfaceorientationportrait;//[Invocation setargument:&val Atindex:2]; [Invocation invoke]; }Else{nsinvocation*invocation =[Nsinvocation Invocationwithmethodsignature:[uidevice instancemethodsignatureforselector:selector]; [Invocation setselector:selector]; [Invocation Settarget:[uidevice Currentdevice]; intval = uiinterfaceorientationlandscaperight;//[Invocation setargument:&val Atindex:2]; [Invocation invoke]; } }
//Screen Rotation-(BOOL) shouldautorotate{returnYES;}//direction of rotation supported//the beginning of the screen rotation direction//direction of rotation supported//the beginning of the screen rotation direction-(Nsuinteger) supportedinterfaceorientations{NSLog (@"11222111111"); returnUiinterfaceorientationlandscapeleft;}-(uiinterfaceorientation) preferredinterfaceorientationforpresentation{returnUiinterfaceorientationlandscapeleft;}
Force toggle between screen