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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:58:26+00:00 2026-06-07T05:58:26+00:00

i have a table view that i want to make a custom uinavigationn bar

  • 0

i have a table view that i want to make a custom uinavigationn bar i tried this code

UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.bounds.size.width, self.view.bounds.size.height)];
//here for v, width= navBar width and height=navBar height
//    
[view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"newsBanner.png"]]];
[self.navigationController.navigationBar addSubview:view];

the problem is the image is not centered cause its size is 640 x 72… is there a way to make it fit?

  • 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-07T05:58:27+00:00Added an answer on June 7, 2026 at 5:58 am

    Your nav bar should only be 44 pixels tall. On top of that, it is maximum 320 points wide (640 px on retina devices, 320 on non-HD devices). So the size of your image is way too big. Make an image that has 320×44 dimensions, and then do this:

    UINavigationBar *theBar = self.navigationController.navigationBar;
    if ( [theBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)] ) {
        UIImage *image = [UIImage imageNamed:@"your image here"];
        [theBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
    }
    

    Of course that will only work on iOS 5. You’ll need to find other ways of handling setting the background on OS below 5.0. But there are plenty of stack overflow questions that address that issue 🙂

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

Sidebar

Related Questions

On each cell of my table view I want to have a bar that
I want to have a ViewController that has a table view on the top
I have a table view that displays a list that I want the user
hello every one i have table view with one cell,and i make on this
I have a UIView in a table view section header that I would like
I have a table view that I am customizing and I am adding a
I have a table view that is managed by an NSFetchedResultsController. I am having
I have one table view that should be filtered by values of search field
I have a table view controller with (among others) a cell that is to
I have a first table view and a segue that pushes to another table

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.