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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:39:30+00:00 2026-06-04T22:39:30+00:00

UINavigationItem has the following private variables UIKIT_EXTERN_CLASS @interface UINavigationItem : NSObject <NSCoding> { @private

  • 0

UINavigationItem has the following private variables

UIKIT_EXTERN_CLASS @interface UINavigationItem : NSObject <NSCoding> {

@private
 NSString        *_title;
 NSString        *_backButtonTitle;
 UIBarButtonItem *_backBarButtonItem;
 NSString        *_prompt;
 NSInteger        _tag;
 id               _context;
 UINavigationBar *_navigationBar;
 UIView          *_defaultTitleView;
 UIView          *_titleView;
 UIView          *_backButtonView;
 UIBarButtonItem *_leftBarButtonItem;
 UIBarButtonItem *_rightBarButtonItem;
 UIView          *_customLeftView;
 UIView          *_customRightView;
 BOOL             _hidesBackButton;
 UIImageView     *_frozenTitleView;

}

Is there any way (using KVC,etc.) to read the UINavigationBar *_navigationBar;
I need this to get access to the undefined backButton. which is not in:

@property(nonatomic,retain) UIBarButtonItem *leftBarButtonItem;
@property(nonatomic,retain) UIBarButtonItem *backBarButtonItem;

  • 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-04T22:39:32+00:00Added an answer on June 4, 2026 at 10:39 pm

    Don’t do this. It violates the fundamental OOP concept of encapsulation. If Apple decides to rearrange the order or meaning of the ivars in the UINavigationItem class, your code may break unpredictably up to and including crashes or man-eating purple dragons.


    That said, if you’re sure you want to go down this evil evil road, you should be able to reach the _navigationBar ivar with:

    UINavigationItem *theItem = ...;
    UINavigationBar *bar = [theItem valueForKey: @"_navigationBar"];
    

    If that doesn’t work (for instance, if Apple has overridden +accessInstanceVariablesDirectly on this class), you can drop down to the Objective-C runtime:

    #include <objc/runtime.h>
    
    UINavigationItem *theItem = ...;
    UINavigationBar *bar = nil;
    Ivar barIvar = class_getInstanceVariable([UINavigationItem class], "_navigationItem");
    if (barIvar) {
        bar = *(UINavigationBar *)((void *)theItem + ivar_getOffset(barIvar));
    }
    

    Both approaches are incredibly dangerous and run the risk of breaking with any and every point release of the operating system. You have been warned. Here be dragons.

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

Sidebar

Related Questions

I want to show the UIBarButtonItem and UINavigationItem through code in the method viewWillAppear
I am using the new API for UINavigationItem setRightBarButtonItems like this: UIBarButtonItem *buttonSettings =
I added a search bar in the UINavigationItem using the following code: UISearchBar *searchBar
I'm using UINavigationItem's titleView property to set a custom UILabel with my desired font
Anyone had a smiliar bug? The control is placed from Interface Builder and not
My application has a UITabBarController . When the first view loads I start a
I'm creating custom UINavigationItem with custom background image and title. The image is shown
Adding an image to a UINavigationItem's titleView is pretty trivial, but when I push
I have a line of code: this.NavigationItem.LeftBarButtonItems = new UIBarButtonItem[] { btnRefresh,btnCalculator}; Works fine
I am currently developing an app that has a TabBarController and each of the

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.