Pages

Showing posts with label Device orientation. Show all posts
Showing posts with label Device orientation. Show all posts

Reacting to the Orientation change of the device

Well guys as you know that you can apply constraints to any object in the storyboard by applying auto layout constraints.Whenever the orientation of the device changes if you are designing interface with storyboard it is good as butter, but when you are so fond of doing everything programmatically you will found that it is quite difficult to react according to the change of the orientation of the device. Well now I will show you a way out of many to tackle to this kind of problem. Well all you will be using is a function named as "didRotateFromInterfaceOrientation()". It takes an argument of "UIInterfaceOrientation" type. This function will get executed whenever user's device orientation will get changed. This function is defined in View Controller super class && any class that wants to use it should "override" this function for performing any additional task.