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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:04:33+00:00 2026-06-15T13:04:33+00:00

I am trying to subclass UINavigationBar with a defined height and trying to implement

  • 0

I am trying to subclass UINavigationBar with a defined height and trying to implement sizeThatFits method:

@implementation NavigationBar

- (CGSize)sizeThatFits:(CGSize)size {
    NSLog(@"frame: %@", NSStringFromCGRect(self.frame));
    return CGSizeMake(self.frame.size.width, 62);
}

@end

But apparently the self.frame.size.width is always returning a weird value which isn’t 1024 which is what I am aiming for and it is causing the behaviour presented below:

NSLog output:

> frame: {{224, 20}, {576, 62}}

While manually defining CGSizeMake(1024, 62) this will cause the following:

hiding the buttons and the NSLog output will be:

> frame: {{-128, 20}, {1280, 62}}

Any idea on how to properly implement this method so the navigation bar extends across all window?

  • 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-15T13:04:34+00:00Added an answer on June 15, 2026 at 1:04 pm

    using layoutSubviews and sizeThatFits together seems to work:

    - (CGSize)sizeThatFits:(CGSize)size {
        return CGSizeMake(1024, 62);
    }
    
    - (void)layoutSubviews {
        [super layoutSubviews];
        self.frame = CGRectMake(0, 20, 1024, 64);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implement a custom UISlider (subclass of UISlider), that behaves in a
I'm currently trying to implement a subclass of stringbuf to allow the buffer to
I am trying to subclass a dictionary for use in an exec method. Ultimately,
I am trying to implement a context menu in my QGraphicsItem subclass like so:
I'm trying to to get a subclass method to return the variable from the
I'm trying to implement a subclass of TextView that prints the text vertically rotated,
I'm trying to subclass an WinApi edit control and override the paint method .
I'm trying to subclass the built-in file class in Python to add some extra
I am trying to subclass the window that currently has focus. I do this
I am trying to subclass the currently focused window on a Windows system using

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.