objective c - it is possible to use UIImagePickerController in landscape mode in iOS? -


my application in landscape mode , want open gallery , select video getting error. there way use uiimagepickercontroller in landscape mode or other alternative way?

- (nsuinteger)supportedinterfaceorientations{ return uiinterfaceorientationmasklandscape; } 

this should work. if app allows portrait. have work in app delegate. need set boolean property, call restrictrotation. include appdelegate.h in class , set restrictrotation true when need rotate it

-(nsuinteger)application:(uiapplication *)application supportedinterfaceorientationsforwindow:(uiwindow *)window { if(self.restrictrotation)     return uiinterfaceorientationmaskportrait; else     return uiinterfaceorientationmaskall; } 

then in class

- (void) orientationchanged:(nsnotification *)note { uidevice * device = note.object; switch(device.orientation) {     case uideviceorientationportrait:         //do stuff         break;     case uideviceorientationlandscapeleft:          //do stuff         break;     case uideviceorientationlandscaperight:        //do stuff         break;     default:         break;    }; } -(void) restrictrotation:(bool) restriction {      appdelegate* appdelegate = (appdelegate*)[uiapplication sharedapplication].delegate; appdelegate.restrictrotation = restriction; } 

that should help


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -