Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

Ipad orientation problem when a splitview is brought in

ashwinr87ashwinr87 Posts: 115Registered Users
Hi,

I have an application in which my first view has a label and a button..when I click the button, I bring in a split view.

The problem I am facing is that, the orientation of the split view is acting wierd. At times, it displays in landscape orientation properly and at other times, it displays in portrait orientation with half of its view cut. During this time, when I change the ipad orientations using the cmd + arrow keys, the split view goes haphazard.

I have included in my info.plist file -> Information property list " Initial interface orientation" and its value " landscape (right home button)". Other than that, I have not made any change...

The main thing which is bugging me is that, this does not happen all the time. It happens off and on.

It would be great if someone could help me out in this.
Post edited by ashwinr87 on

Replies

  • BrianSlickBrianSlick Posts: 9,311Tutorial Authors, Registered Users
  • ashwinr87ashwinr87 Posts: 115Registered Users
    hi brian.. i am unable to upload my code here due to size restrictions..
    if you want, I can send u a zipped project by mail if you send me ur mail id..
    let me know...
    thanks
    BrianSlick;320002 said:
    Show some code. How are you putting the split view on the screen?
  • BrianSlickBrianSlick Posts: 9,311Tutorial Authors, Registered Users
    I am not going to look at your entire project for free. Post the relevant sections code. It should only be a few lines of code.
  • ashwinr87ashwinr87 Posts: 115Registered Users
    BrianSlick;321750 said:
    I am not going to look at your entire project for free. Post the relevant sections code. It should only be a few lines of code.


    ok...

    Here is what I have in my app delegate
    - (void) makeSplitViewController {

    NSMutableArray *controllers = [NSMutableArray arrayWithArray:tabBarController.viewControllers];

    // First tabbbar item
    // detail view
    detailViewController = [[DetailViewController alloc] initWithNibName:@\"DetailView\" bundle:nil];
    UINavigationController *navDetailView = [[[UINavigationController alloc] initWithRootViewController:detailViewController] autorelease];
    navDetailView.hidesBottomBarWhenPushed = YES;


    // root view
    rootViewController = [[RootViewController alloc] initWithStyle:UITableViewStylePlain];
    rootViewController.detailViewController = detailViewController;
    rootViewController.navigationItem.title = @\"List\";

    UINavigationController *navRootView = [[[UINavigationController alloc] initWithRootViewController:rootViewController] autorelease];
    navRootView.hidesBottomBarWhenPushed = YES;
    navRootView.navigationBar.barStyle = UIBarStyleBlackTranslucent;

    splitViewController = [[UISplitViewController alloc] init];
    splitViewController.tabBarItem.title = @\"Face Sheet\";
    splitViewController.tabBarItem.image = [UIImage imageNamed:@\"gear1.png\"];
    splitViewController.navigationItem.title = @\"Face Sheet\";
    splitViewController.viewControllers = [NSArray arrayWithObjects:navRootView, navDetailView, nil];
    splitViewController.delegate = detailViewController;
    splitViewController.hidesBottomBarWhenPushed = YES;
    [controllers addObject:splitViewController];

    // Second tabbbar item
    scoreViewController = [[ScoreCardViewController alloc] initWithNibName:@\"TableViewController\" bundle:nil];
    scoreViewController.tabBarItem.title = @\"Score Card\";
    scoreViewController.tabBarItem.image = [UIImage imageNamed:@\"gear1.png\"];
    scoreViewController.navigationItem.title = @\"Score Card\";
    [controllers addObject:scoreViewController];

    tabBarController.viewControllers = controllers;
    }

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

    // Override point for customization after application launch.
    // Create tabbar
    tabBarController = [[UITabBarController alloc] init];
    //tabBarController.delegate = self;

    // Set window
    [window addSubview:splashController.view];
    [window insertSubview:tabBarController.view belowSubview:splashController.view];
    [self.window makeKeyAndVisible];

    application.statusBarOrientation = UIInterfaceOrientationLandscapeRight;

    return YES;
    }


    Here is what I have my in SplashScreenView

    - (IBAction) proceedButtonClick:(id)sender
    {
    // Initialize loginpopview
    PhysicianLoginViewController *loginViewController = [[PhysicianLoginViewController alloc] init];

    popOverController = [[UIPopoverController alloc] initWithContentViewController:loginViewController];
    popOverController.popoverContentSize = CGSizeMake(350, 200);
    popOverController.delegate = self;

    // Set a notification to dismiss it later
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginViewControllerDone:) name:@\"loginViewControllerDone\" object:popOverController.contentViewController];

    // Present popover
    if ([popOverController isPopoverVisible])
    {
    [popOverController dismissPopoverAnimated:YES];
    }
    else
    {

    [popOverController presentPopoverFromRect:CGRectMake(485, 600, 100, 100) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
    }

    }

    // Dismiss popview controller and setup the tabbar
    - (void)loginViewControllerDone:(NSNotification *)notification
    {
    [[NSNotificationCenter defaultCenter] removeObserver:self];

    // Button in content view controller was tapped, dismiss popover...
    [self.popOverController dismissPopoverAnimated:YES];

    // remove subview
    [self.view removeFromSuperview];

    // set tabbar
    i3EAppDelegate *appDelegate = (i3EAppDelegate *) [[UIApplication sharedApplication]delegate];
    [appDelegate makeSplitViewController];

    }


    I have posted what I felt is the important part.. let me know...
  • BrianSlickBrianSlick Posts: 9,311Tutorial Authors, Registered Users
    For future reference, the following pieces of information would have been useful to include in the first post:

    - Oh yeah, and I'm trying to put this split view controller inside a tab bar controller.
    - And what I have so far comes from this thread.

    Now I'm not positive, but I suspect that your issue is right here:
    [window addSubview:splashController.view];
    [window insertSubview:tabBarController.view belowSubview:splashController.view];


    I always have issues when I add more than one view to the window. You may be able to find a solution in this thread.
  • ashwinr87ashwinr87 Posts: 115Registered Users
    thank you for your quick reply.. I will look into it...
    I would like to mention one more thing.. say if I change the code as below

    [window addSubview:tabBarController.view];
    [window insertSubview:splashController.view aboveSubview:tabBarController.view]


    what happens now is that, the splash controller comes in the haphazard manner (i.e. its view in landscape but its components in portrait) but the splitview controller is coming perfectly... I had also got the issue down to the
    [window insertSubview]
    but unable to solve the issue..
    BrianSlick;321760 said:
    For future reference, the following pieces of information would have been useful to include in the first post:

    - Oh yeah, and I'm trying to put this split view controller inside a tab bar controller.
    - And what I have so far comes from this thread.

    Now I'm not positive, but I suspect that your issue is right here:
    [window addSubview:splashController.view];
    [window insertSubview:tabBarController.view belowSubview:splashController.view];


    I always have issues when I add more than one view to the window. You may be able to find a solution in this thread.
Sign In or Register to comment.