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

  • Home
  • SEARCH
  • 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 6865131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:00:08+00:00 2026-05-27T03:00:08+00:00

I am creating a UIToolbar programmatically but the issue is the position of this

  • 0

I am creating a UIToolbar programmatically but the issue is the position of this tool bar is up (navigation bar position). how can I put it automatically on the bottom?

Here is my code:

    CGRect rect2 = CGRectMake(0, toolBar.frame.origin.y , self.view.frame.size.width , 0);
    toolBar = [[UIToolbar alloc]initWithFrame:rect2];
    toolBar.barStyle = UIBarStyleBlackTranslucent;
    [toolBar sizeToFit];
    [self.view addSubview:toolBar];
    [toolBar release];

because my application is universal and my view controller class does not have any nib file I need to define it for both iPad and iPhone, and I don’t want use UIUserInterfaceIdiomPad.

  • 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-05-27T03:00:09+00:00Added an answer on May 27, 2026 at 3:00 am

    You’re setting rect2‘s y position to the value of [toolbar frame].origin.y, which at that point in the code is either nil, or pointing to some other instance of a toolbar, because you then immediately afterwards alloc and init a new toolbar.

    Even if the toolbar was valid when you set it’s frame, you can’t use it’s current y value as the new y value, because it will be 0.

    You should position it relative to the bottom of the screen, minus the height of the toolbar. Try this instead:

    CGRect frame = CGRectMake(0, [[UIScreen mainScreen] bounds].size.height - 44, [[UIScreen mainScreen] bounds].size.width, 44);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Creating extensions got much easier with Vs2010, but this seems not to be the
I'm creating a UIToolbar with nothing but a UILabel placed on it. the label
Creating the closure is easy but using it is confusing for me. Here is
Creating Traversals for Binary Search Tree with Recursion. void inOrder(void (*inOrderPtr)(T&)) { if(this->left !=
(creating a separate question after comments on this: Javascript redeclared global variable overrides old
Creating a mini-database with access, i came across this problem: For the background, i
Creating an Iphone application, I used to perform INSERT QUERY on different databases. But
Creating a simple TCP server based on examples but still do not get how
Creating a web interface so our helpdesk can create users and setup some of
I am having weird problem with Programmatically created UIToolbar and UIWebView UIWebView frame size

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.