DanijelHuis / HDAugmentedReality

Augmented Reality component for iOS, written in Swift.
MIT License
480 stars 97 forks source link

iOS 8+ Orientation Change Handling #11

Closed jvigneshcs closed 8 years ago

jvigneshcs commented 8 years ago

Handling orientation change for iOS 8+ OS versions.

DanijelHuis commented 8 years ago

Hi, thank you for contribution.

I don't have iOS8+ device currently so I cannot test this(will test in Monday), just by looking at it seems that reloadUIOnOrientationChange would get called twice on iOS8? It would get called from willAnimateRotationToInterfaceOrientation and from statusBarOrientationChanged.

Old rotation methods are deprecated but should still be called on iOS8+ and everything should work fine.

Once swift 3 is released I will remove iOS7 support and reimplement rotation handling, probably with viewWillTransitionToSize to accomodate multitasking on ipad etc.

jvigneshcs commented 8 years ago

reloadUIOnOrientationChange would get called twice on iOS8?

No it won't, willAnimateRotationToInterfaceOrientation didn't get called in iOS 8+ devices.

viewWillTransitionToSize is only for views, for changing the camera orientation we would still need orientation change notification.

DanijelHuis commented 8 years ago

I downloaded patch-1 and tested it on iOS 9 device. willAnimateRotationToInterfaceOrientation is called and setOrientation is called two times. It might be that it is not called in some special cases or when orientation is locked.

statusBarOrientation is deprecated on iOS9 so I cannot use that. viewWillTransitionToSize is called when orientation changes so I think I can use that to determine for all view/orientation changes. Anyway, orientation change will be adapted to iOS9.

DanijelHuis commented 8 years ago

This changes were manually implemented in version 1.1.0 because of swift 3 adaptation and some merging problems..

Thank you.