I am creating one project in viewcontroller. I have image view, labels and scrollview
. But when I change the orientation its aligning in bad way?
Is there any way to align correctly? Also my scrollview is not working. I set the delegate as view in storyboard.my controll frame are(landscape mode).
book_cover_image.frame=CGRectMake(50,20,250,300);
label_book_name.frame=CGRectMake(350,20,500,50);
label_book_author.frame=CGRectMake(350,76 , 500, 50);
label_book_price.frame=CGRectMake(350,135, 500, 50);
image_price_rupees.frame=CGRectMake(100, 330, 22, 16);
[buy_button setFrame:CGRectMake(13, 380, 119, 32)];
[preview_button setFrame:CGRectMake(150, 380, 113, 32)];
RecommendedBooksView.frame=CGRectMake(0,400,1024,368);
_thumbnailListView.frame=CGRectMake(15, 50, 950,350);
You might consider using autoresizingMask property of UIView to automatically resize and reposition views during rotation.
http://www.techpaa.com/2012/05/understanding-uiview-autoresizing.html
If the autoresizingMask cannot do what you want, you can customize the frame for each orientation by implementing:
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration {
[UIView animateWithDuration:duration animations:^{
//set new frame properties
}];
}
in your view controller.