If anyone has the same issue in future this line solved my problem. Maybe it was my mistake that i had forgotten this.So i had to add this line to my viewDidLoad method.
self.view.autoresizingMask= UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;