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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:47:30+00:00 2026-06-14T12:47:30+00:00

Today I started messing with Storyboarding in Xcode and there is one issue that

  • 0

Today I started messing with Storyboarding in Xcode and there is one issue that kind of makes me feel stupid:

I have a storyboard with a navigation controller and a table view as its root view. Now I added a bar button item to the navigation bar. As I wanted this button to have a custom background I assigned my custom UIBarButtonItem class to this button by selecting the name of my class in the “custom class” field.

The class itself looks like this:

- (id)initWithTitle:(NSString *)title style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action
{
    self = [super initWithTitle:title style:style target:target action:action];

    if (self) {
        [self setBackgroundImage:[self buttonBg] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
    }
    return self;
}

- (id)initWithImage:(UIImage *)image style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action
{
    self = [super initWithImage:image style:style target:target action:action];

    if (self) {
        [self setBackgroundImage:[self buttonBg] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
    }
    return self;
}

- (UIImage *)buttonBg
{
    return [[UIImage imageNamed:@"navBarButton.png" ] resizableImageWithCapInsets:UIEdgeInsetsMake(15, 6, 15, 6)
                                                                     resizingMode:UIImageResizingModeTile];
}

I wrote this class assuming to add a button programmatically, of course this works as I can call the initializer by myself. The problem is that I don’t know which initializer is called by the Interface Builder, I even tried to overwrite the basic “init”, but it seems that this one is also not called …

I did a lot of searching but didn’t find the right stuff, although I’m certain that this is basic stuff. So please apologize. 🙂

  • 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-14T12:47:31+00:00Added an answer on June 14, 2026 at 12:47 pm

    Interface Builder will always call initWithCoder:. It makes sense, as the IB / storyboard file is actually an XML-encoded file that has to be decoded.

    I usually define my own initialize method and call that from any overridden init methods.

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

Sidebar

Related Questions

Today I started coding a project that uses sqlite and when I tried to
Started Googling today to research implementing Zend_Translate in a Zend 1.6.x project i have
I am a beginner in node.js (infact started just today). One of the basic
greetings, today i have started to learn java using netbeans ide. i would like
Today I started observing some new kind of error which does not allow me
I've just (as in today) started working on some ZF stuff. I have a
Today I started learning how to develop for Windows Phone, and I have a
The problem I have just started today, without really changing the code at all.
I'm very new to javascript (started messing with it today). I'm trying to change
Today I started work on a small Java app. I have some experience with

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.