mercredi 15 juin 2016

How to find view controller of screen


I have seen the following code that allows someone to get the screen orientation of a device:

    if(UIInterfaceOrientationIsPortrait(viewController.interfaceOrientation)) {
    //do portrait work
} else if(UIInterfaceOrientationIsLandscape(viewController.interfaceOrientation)){
    //do landscape work
}

The problem is I am not sure what to substitute for the "viewController" placeholder code. It is worth noting that I am making a keyboard app so I am not sure if I can use the same view controllers that might work for other circumstances. What controller can I use to tell the orientation of the screen?


Aucun commentaire:

Enregistrer un commentaire