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 8141777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:37:31+00:00 2026-06-06T12:37:31+00:00

I am creating something similar to a SplitFrameViewController, but with enough differences that I

  • 0

I am creating something similar to a SplitFrameViewController, but with enough differences that I am making a custom implementation. My problem arises when I am trying to size the “Master” view to be 25% of the available screen and the “Detail” view to be the remaining 75%.

No matter what I try though, the size is incorrect. The MasterView is much too wide and the Detail overlaps a bit. I think I might be doing something incorrect in my nib files, but I’m not quite sure. The resulting sizes on the iPad emulator looks like about 35% for the master view and about 80% for the detail view.

Also, if anyone has any criticism/comments/suggestions on my project structure, feel free to comment on that as well, as this is my first attempt.

AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    self.containerViewController = [[ContainerViewController alloc] init];
    self.window.rootViewController = self.containerViewController;

    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];

    return YES;
}

ContainerViewController

I have checked the widths of the resulting rectangles in viewWillAppear, and they are correct.

- (id)init
{
    self = [super init];
    if (self) {
        self.masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil];
        self.detailViewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
        [self addChildViewController:self.masterViewController];
        [self addChildViewController:self.detailViewController];
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self.view addSubview:self.masterViewController.view];
    [self.masterViewController didMoveToParentViewController:self];
    [self.view addSubview:self.detailViewController.view];
    [self.detailViewController didMoveToParentViewController:self];
}

- (void)viewDidUnload
{
    self.masterViewController = nil;
    self.detailViewController = nil;
    [super viewDidUnload];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    CGRect containerBounds = self.view.bounds;
    CGRect masterBounds, detailBounds;
    CGRectDivide(containerBounds, &masterBounds, &detailBounds, CGRectGetWidth(containerBounds) * 0.25, CGRectMinXEdge);

    self.masterViewController.view.frame = masterBounds;
    self.detailViewController.view.frame = detailBounds;
}

Edit

I added the following lines to the end of viewWillAppear and got the commented results.

NSLog(@"container bounds: %@", NSStringFromCGRect(containerBounds));
NSLog(@"master bounds: %@", NSStringFromCGRect(masterBounds));
NSLog(@"detail bounds: %@", NSStringFromCGRect(detailBounds));

// container bounds: {{0, 0}, {768, 1004}}
// master bounds: {{0, 0}, {192, 1004}}
// detail bounds: {{0, 0}, {576, 1004}}
  • 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-06T12:37:33+00:00Added an answer on June 6, 2026 at 12:37 pm

    Oh my gosh I figured it out. So I am running my application only in Landscape orientation. But I was getting the frame measurements in Portrait mode. Apparently, even if it only launches, runs, and supports landscape mode, it first creates the view in portrait mode and then switches to landscape mode. ViewWillAppear was running before the switch (even though everything I have read says it is supposed to go after). I moved the code in my ViewWillAppear block to (void)viewWillLayoutSubviews and it worked fine.

    Another reason that there might have been an issue is that technically my RootViewController’s view property shouldn’t exist, although it was returning values from within the class, just not outside of it. Honestly just odd behavior in general. Anyway, if anyone else has this problem, that’s the answer.

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

Sidebar

Related Questions

I'm making a taskbar for something (I'll be creating similar to the windows taskbar).
I'm creating a notification with something similar to the following: Intent ni = new
I'm creating something that includes a file upload service of sorts, and I need
Here's something that has been bugging me... I am currently creating an application for
How to do that without creating any new collections? Is there something better than
I always see people using Thread.Sleep() for creating delays in processing or something similar
I want to create something similar to TextExpander - a macro program that watches
I am creating a custom server control with a property that accepts a String
I'm trying to mimic something similar to FB. Basically, users can post comments in
I was looking at the tutorial at http://jqueryfordesigners.com/jquery-infinite-carousel/ . I tried creating something similar

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.