i am doing application where i have taken two views Portrait and Landscape. i am creating a label programitically and calling it by parameter passing.As i want the position of the label to be changed in the landscapeView so i am taking two views.Instead i want to do in a SingleView
instead of using two views i want to have only one view and set the label position accordingly in portrait and landscape.
so please suggest me how to have only one view and change the textLabel position according to the view..please suggest me with sample code.
At present i am using the below code
[self.portraitView addSubview:[self createLabel:CGRectMake(450,140,60,20):@"Ratings:"]];
[self.landscapeView addSubview:[self createLabel:CGRectMake(600,140,60,20):@"Ratings:"]];
-(UILabel*)createLabel:(CGRect)frame :(NSString*)labelTitle {
UILabel *myLabel = [[UILabel alloc] initWithFrame:frame];
[UIFont fontWithName:@"Arial" size:13];
myLabel.text = labelTitle;
}
-(void) viewDidLoad
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
You will need to dig around a little bit for covering all the possible orientations in this method.
Cheers!!!