Archana Chaurasia
Archana Chaurasia

Reputation: 1396

Problem in set view in Landscape mode

enter image description hereI have a tab based application with 4 views associated with 4 tabs. I want all 3 views in portrait form and only one landscape form.

I have done these settings for that particular view:

Set the required value in Supported interface orientations of info.plist.

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight)
}

In IB set the orientation attribute as landscape.

In -(void)viewDidLoad I have set self.view.frame=CGRectMake(0, 0, 480, 320);

After done all above setting, its still not coming in landscape mode.

Upvotes: 0

Views: 613

Answers (1)

PengOne
PengOne

Reputation: 48398

If I understand your question correctly, and please correct me if I do not, then you want to have 3 views in portrait all of the time and one view in landscape all of the time. To accomplish this, set the orientation of the status bar for each viewController in viewWillAppear:

-(void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight;
}

Upvotes: 1

Related Questions