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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:49:04+00:00 2026-06-13T14:49:04+00:00

I am looking for general guidance on how to handle this situation. Here is

  • 0

I am looking for general guidance on how to handle this situation. Here is a specific example.

I am subclassing UIImageView and I want to override initWithImage to add my own initialization code after having the super class init itself with the supplied image.

However, there is no documented designated initializer for UIImageView, so which super class initializer should I call to ensure my subclass is correctly initialized?

If a class does not designate an initializer, do I:

  1. Assume that it is safe to call any of the class’s (UIImageView) initializers?
  2. Look to the super class (UIView) for the designated initializer?

In this case it seems #1 would be the answer as it makes sense to do the following in my overridden initializer:

- (id)initWithImage:(UIImage *)image
{
    self = [super initWithImage:image];
    if (self) {
        // DO MY EXTRA INITIALIZATION HERE
    }
    return self;
}
  • 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-13T14:49:05+00:00Added an answer on June 13, 2026 at 2:49 pm

    UIImageView has two initializers, so you may want to make sure that your subclass handles both of these initialization paths.

    You could simply declare that -initWithImage: is your designated initializer, and all other initializers are not supported.

    Further, you could implement -initWithImage:highlightedImage: and throw an exception to indicate that it’s not supported.

    Alternatively, you could declare -initWithImage:highlightedImage: as your designated initializer, and have -initWithImage: call your designated initializer.

    Or, you may find that your -initWithImage: initializer is called regardless of whether your class is initialized with -initWithImage: or -initWithImage:highlightedImage:.

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

Sidebar

Related Questions

I am looking for some general guidance on this one... I have created a
Looking for general guidance on implementing row/record level security in a lightswitch application. Classic
I am looking for a general and complete solution to this common problem! I
I've found a similar question here , but I'm looking for more general solutions.
I'm looking for some general guidance as to how to return a user back
I'm looking for some general guidance on serializing objects in a database. What are
I am developing an app and am looking for some general guidance: The app
I am looking for some guidance/opinion on the best way forward to add field
I would like to add index(s) to my table. I am looking for general
So I've seen this question , but I'm looking for some more general advice:

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.