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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:31:39+00:00 2026-06-08T05:31:39+00:00

I’m writing app which is aimed only for iOS5 devices, so I’m trying to

  • 0

I’m writing app which is aimed only for iOS5 devices, so I’m trying to maximize usage of new appearance API.

I can change background of my UIToolbar with following method:

[[UIToolbar appearance] setBackgroundImage:<myImage> forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];

Everything works fine, but I’m looking for more customization, so I was wondering about usage of UIToolbarPosition and I run into some problems. Using InterfaceBuilder or adding UIToolbar programmatically I’m positioning it at the top of main view – so I’m expecting UIToolbarPosition to be set as UIToolbarPositionTop, but from what I’m testing it doesn’t work automaticly nor can I find any API which allows me to set UIToolbarPosition (Yes, I googled it already).

So – main question – how to create UIToolbar and tag it properly, so it can response only to UIToolbarPositionTop or UIToolbarPositionBottom, so I can use:

[[UIToolbar appearance] setBackgroundImage:<myImage_1> forToolbarPosition:UIToolbarPositionTop barMetrics:UIBarMetricsDefault];

[[UIToolbar appearance] setBackgroundImage:<myImage_2> forToolbarPosition:UIToolbarPositionBottom barMetrics:UIBarMetricsDefault];

EDIT: More details, as asked.

I have multiply toolbars in my application – for instance, toolbars at top of the screen on 2 screens, toolbars acting as accessory views for keyboard and 2 toolbars at the bottom of modals screens. I’d like to maximize usage of new appearance API instead of customizing toolbars on each screens, hence I’m asking about whole UIToolbarPosition thing and how to use it.

I know I can achieve what I want just by customizing each UIToolbar separately, but I’m just curious about new API and UIToolbarPosition usage.

  • 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-08T05:31:42+00:00Added an answer on June 8, 2026 at 5:31 am

    UIToolbarPostion isn’t a property that you’re supposed to be setting programmatically – instead, it allows you to tell the program how to handle a toolbar when it’s in different positions. This is mostly for toolbars that are getting pushed around by screen changes (autorotation) or are on something like a navigation controller that has variable content.

    That being said, if you want to directly access your toolbars so that you can use them/set properties/etc there are a couple of methods. It sounds like you know what tagging is, and this is a valid method – just give the toolbar a tag in IB or programmatically (either edit the tag property in the side bar for IB or use the .tag property when you declare the toolbar). Then you can use the viewWithTag method to access your toolbar. However, a better method would be to just create an IB property for the toolbar (same as with labels or buttons) by control-dragging over to the header file from the toolbar. Then you could just write [nameOfToolbarProperty doSomeMethod]. If you’re creating your toolbar with code then just make a reference to it the same way e.g.

    UIToolbar *tref = [/*toolbar creation code*/];

    In conclusion, your code

    [[UIToolbar appearance] setBackgroundImage:<myImage_1> forToolbarPosition:UIToolbarPositionTop barMetrics:UIBarMetricsDefault];
    

    could be made to work by adding

    //Connect this to your toolbar in Interface Builder
    @property (weak, nonatomic) IBOutlet UIToolbar *tref;
    

    to your header. Then just do

     [tref setBackgroundImage:<myImage_1> forToolbarPosition:UIToolbarPositionTop barMetrics:UIBarMetricsDefault];
    

    Note that this just tells the program what image to display if the toolbar is in the top position – it does not set the position of the toolbar. UIToolbarPosition is a constant (so you cannot set it).

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I want use html5's new tag to play a wav file (currently only supported
I am writing an app with both english and french support. The app requests
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words

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.