Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8772309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:00:26+00:00 2026-06-13T18:00:26+00:00

I am using UIViewController for display my view. My view have been created in

  • 0

I am using UIViewController for display my view. My view have been created in interface builder.

Right now these are next parameters for view:

width: 568
height: 320
Orientation: Landscape

in ViewController I have next code:

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

in info.plist I have added just two interface orientation right and left.

but when I try to output width of my view in code I get 320 and when I try to output height it write down in console 568 but I expect 320 instead.

I don’t know why it works like this. Any suggestions?

even if I add this:

[self.view setFrame:CGRectMake(0, 0, 568, 320)]; in viewDidLoad method. even then I have inccorect height

I need to know width size I use in this method:

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
    CGFloat width = 0.0f;
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        width = 568.0f;
    } else {
        width = 1024.0f;
    }    
    NSInteger page = scrollView.contentOffset.x / width;
    NSLog(@"%d", page);
}

Right now I use hardcode variable of width, but how come. Why I can’t use self.view.frame.size.width because the sides swop each other – because.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:00:27+00:00Added an answer on June 13, 2026 at 6:00 pm

    Maybe you’re printing width and height in the viewDidLoad method before the orientation occurs. Try to print it on viewWillAppear or with performSelector:afterDelay:

    Another thing that might affect the dimension of the view is how you set the autoresizing mask on the interface builder (the red arrows below the x,y,height,width section on the right panel)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created a custom container view controller using the new UIViewController container view controller
I am using one UIViewController as shown: @interface RssViewController : UIViewController <UITableViewDataSource,UITableViewDelegate,BlogRssParserDelegate> I am
For my iPad app, I'm using a UIViewController subclass called SidebarViewController to display some
I have a UIViewController, and within that view i have UITableView added in IB
I have a simple table view which I have built using an example from
I am new to iphone development, i have created sms application using Text Links(sms:)
I currently have a UITextView which is contained in a UIViewController using the following
I want to display PickerView when I click the button. I have a view
I have a view hierarchy that has a UIViewController as Files Owner in the
I have created a custom view that contains a UIPickerView and a UITableViewCell to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.