I have a mainView. To this view, I am adding a view of the same size. When the mainView(the background) rotates, its being detected but the subview doesnt have any idea about being rotated. And its functions are not even being called. Even when the program launches too, if I am in landscape mode, its the same way.
How can I make the subView know that the device is being rotated?
You could fire an
NSNotificationwhen the main view is rotated, which the subview is registered to listen for. There’s a quick overview ofNSNotificationover here.One advantage of this approach is that objects other than subclasses of
UIViewcan listen for this notification.