Skip to content

Can't click inside subviews after changing frame and bounds of UINavigationView #2

@MCKRUZ

Description

@MCKRUZ

I wanted to have the UINavigation controller at the bottom of the screen rather then the top. So I created this method to move it.

  • (void) setupNavController
    {
    // Initialize the Navigation Controller
    navigationController = [[UINavigationController alloc] init];

    // Get the bounds of the main view
    CGRect viewFrame = self.view.frame;

    // Get the height of the toolbar
    CGFloat barHeight = self.navigationController.navigationBar.frame.size.height;

    // Calculate the new y for the bar
    CGRect navFrame = navigationController.view.frame;
    navFrame.origin.y = ((viewFrame.size.height - viewFrame.origin.y) - barHeight);
    navigationController.view.frame = navFrame;

    // Calculate the new bounds of the views in the nav controller
    CGRect navBounds = navigationController.view.bounds;
    navBounds.origin.y = viewFrame.size.height;
    navigationController.view.bounds = navBounds;
    }

It all works perfectly until you go to try to click inside the views, which you can't. It's almost as if the clickable area isn't correct.

Any suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions