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

  • Home
  • SEARCH
  • 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 7952337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:49:54+00:00 2026-06-04T02:49:54+00:00

I have a subclass of UINavigationBar class. In viewDidLoad i have: – (void)viewDidLoad {

  • 0

I have a subclass of UINavigationBar class. In viewDidLoad i have:

- (void)viewDidLoad
{
    [super viewDidLoad];

    UINavigationBar *bar = [[UINavigationBar alloc] init];

    NSString* path = [[NSBundle mainBundle] pathForResource:@"topbanner" ofType:@"png" inDirectory:@"assets"];

    NSData *data = [NSData dataWithContentsOfFile:path];

    UIImage *image = [UIImage imageWithData:data];

    [[UINavigationBar appearance] setBackgroundImage:image forBarMetrics:UIBarMetricsDefault]; //crash here!

    [self.view addSubview:bar];
}

And i call it from my tableView. When i run on simulator everything is fine, when i try to run on the device app crash. I have an error:

+[UINavigationBar appearance]: unrecognized selector sent to class 0x3e3fe490
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UINavigationBar appearance]: unrecognized selector sent to class 0x3e3fe490'

Why?

EDIT:
my topbanner file i have in blue directory folder in Xcode. In emulator everything looks fine.

EDIT2:
Of course, when i remove this line of code in my device my app looks good to, but there is no image on navigationbar (oc).

  • 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-04T02:49:56+00:00Added an answer on June 4, 2026 at 2:49 am

    The appearance method is new to iOS 5.0. You are probably using the simulator with iOS 5.0, but your device might use a lower iOS version.

    It is better to check with respondsToSelector before calling it to modify the appearance using this method.

    From the UINavigationBar documentation:

    Prior to iOS v5.0, when used in conjunction with a navigation
    controller, there are only a handful of direct customizations you can
    make to the navigation bar. Specifically, it is alright to modify the
    barStyle, tintColor, and translucent properties, but you must never
    directly change UIView-level properties such as the frame, bounds,
    alpha, or hidden properties directly. In addition, you should let the
    navigation controller manage the stack of navigation items and not
    attempt to modify these items yourself.

    http://developer.apple.com/library/ios/#documentation/uikit/reference/UINavigationBar_Class/Reference/UINavigationBar.html

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

Sidebar

Related Questions

I have subclass a UITableViewCell as follows: @class MyCell; @protocol MyCellDelegate - (void) viewController:(MyCell*)viewCon
I have subclass of UINavigationBar . @interface MyNavigationBar : UINavigationBar Made some changes and
HI All. I have subclass of UIScrollView. IN this class I have added some
I have subclass UIView class in a Bounce class with Accelerometer. This Bounce class
I have a subclass of NSWindowController that has its own nib and another class
I have a subclass and I want it to not include a class attribute
I have a subclass of NSManagedObject Class used with Core Data in iPhone. However,
I have a subclass of an ArrayAdapter declared like this public class ShoppingCartAdapter extends
ok I have a subclass of TitleWindow with this method: public function launchInNewWindow(e:Event):void {
I have subclassed a system class (UINavigationBar, to be specific) to add some specific

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.