Properly handle orientation changes across iOS 7 and 8.