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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:51:01+00:00 2026-06-12T01:51:01+00:00

Since starting with iPhone app development (last 9 months) I have only used IB.

  • 0

Since starting with iPhone app development (last 9 months) I have only used IB. I have a project to work on already built by another developer that I need to optimise for iPhone screen. No problem in IB, I know how to do that, in this project however the Nav bar is added using code only and is an image view. Could someone advise me how I go about resizing/positioning the nav bar when IB isnt used? Im trying to enhance this app for the iphone 5 screen.

#define BAR_FRAME CGRectMake(0,0,320.0f,43.0f)

 @implementation ICNavbarView
 @synthesize homeButton=__homeButton;
  @synthesize prevButton=__prevButton;
 @synthesize nextButton=__nextButton;
 @synthesize delegate=__delegate;

- (id)initWithFrame:(CGRect)frame
 {
LogCmd();
self = [super initWithFrame:BAR_FRAME];
if (self) {
    self.backgroundColor = [UIColor clearColor];
    self.alpha = 0.9f;

    // Add Navigation bar background       // <<<<<< navigation bar from ui image
    UIImageView *bgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"BgNavBarNew"]];
    [self addSubview:bgView];




    // Add back button
    __prevButton = [UIButton buttonWithType:UIButtonTypeCustom];
    __prevButton.frame = CGRectMake(30.0f, 6.0f, 29.0f, 31.0f);
    UIImage *prevButtonPressed = [UIImage imageNamed:@"BtnPrevPressed"];
    [__prevButton setImage:[UIImage imageNamed:@"BtnPrev"] forState:UIControlStateNormal];
    [__prevButton setImage:prevButtonPressed forState:UIControlStateSelected];
    [__prevButton setImage:prevButtonPressed forState:UIControlStateHighlighted];
    [__prevButton addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:__prevButton];

    // Add next button
    __nextButton = [UIButton buttonWithType:UIButtonTypeCustom];
    __nextButton.frame = CGRectMake(262.0f, 6.0f, 29.0f, 31.0f);
    UIImage *nextButtonPressed = [UIImage imageNamed:@"BtnNextPressed"];
    [__nextButton setImage:[UIImage imageNamed:@"BtnNext"] forState:UIControlStateNormal];
    [__nextButton setImage:nextButtonPressed forState:UIControlStateSelected];
    [__nextButton setImage:nextButtonPressed forState:UIControlStateHighlighted];
    [__nextButton addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:__nextButton];

    // Add home button
    __homeButton = [UIButton buttonWithType:UIButtonTypeCustom];
    __homeButton.frame = CGRectMake(145.0f, 6.0f, 31.0f, 30.0f);
    UIImage *homeButtonPressed = [UIImage imageNamed:@"BtnHomePressed"];
    [__homeButton setImage:[UIImage imageNamed:@"BtnHome"] forState:UIControlStateNormal];
    [__homeButton setImage:homeButtonPressed forState:UIControlStateSelected];
    [__homeButton setImage:homeButtonPressed forState:UIControlStateHighlighted];
    [__homeButton addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:__homeButton];
}
return self;
}

 - (id)init
{
return [self initWithFrame:CGRectZero];
 }

 #pragma mark - Button handlers

- (void)buttonPressed:(id)sender
{
if (sender == __prevButton) {
    [self.delegate performSelector:@selector(navBarPrevButtonPressed)];
} else if (sender == __homeButton) {
    [self.delegate performSelector:@selector(navBarHomeButtonPressed)];
} else {
    [self.delegate performSelector:@selector(navBarNextButtonPressed)];
}
}

@end

So far I tried UIViewAutoresizingFlexibleHeight; like this

 // Add Navigation bar background
    UIImageView *bgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"BgNavBarNew"]];
    [self addSubview:bgView];


    //resize

    bgView.autoresizingMask =  UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;

This seems to make no difference and the nav bar hasn’t moved

  • 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-12T01:51:03+00:00Added an answer on June 12, 2026 at 1:51 am

    I’ve used this before, but I used the setter function instead of using the property. I don’t know if that would change anything or not, but try it this way:

        [bgView setAutoresizingMask:(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth)];
    

    The parens are important, if you have multiple re-sizing options.

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

Sidebar

Related Questions

Since now I have only used plugin for editing and the way I use
I started by creating a universal window based app. Starting with the iPhone version
So I built my iPhone app and it runs fine in the simulator so
We have a large project at work, under source control, including an MSBuild file
A little background: I'm a C# developer starting to mess with the iPhone (have
since my app is finished (enough) I'm starting to implement the UI changes that
I'm starting to go a little crazy with this one. I have an iphone
I'm new both to Django and unit testing but since I'm starting a project
I used a screenshot plugin for ios when I developed an iphone/ipad app. I
I have an iPhone app which uses ASIHTTPRequest to communicate to a REST service

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.