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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:54:46+00:00 2026-05-31T17:54:46+00:00

I am trying to create a small indicator inside of a UIButton . Ive

  • 0

I am trying to create a small indicator inside of a UIButton. Ive placed a custom view and changed the custom class in Interface builder to be my class. Ive then created an IBOutlet of the same type and connected them in interface builder as well.

My subclass then looks like this:

- (UIView *)initWithNumber:(NSInteger *)number
{
    self = [super initWithFrame:CGRectMake(0, 0, 34, 17)];
    if (self) {
        [self setBackgroundColor:[UIColor blueColor]];

    }
    return self;
}

then in the main view I do:

self.indicatorControl = [indicatorControl alloc] initWithNumber:(NSNumber *)32];

But its not initializing the view and changing the background color when the view loads? Why doesn’t this happen? If I put the setBackgroundColor method call in awakeFromNib it works, but I want it to initialize and return my view when I call my initialization. It seems like this should work.

  • 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-05-31T17:54:47+00:00Added an answer on May 31, 2026 at 5:54 pm

    If you keep the IBOutlet there interface builder will re-initialize your button, overwriting your in-code button creation. Do you want to initialize the button in code or interface builder?

    I would suggest:

    Code: de-link the button from interface builder and put code in viewDidLoad of parent view controller
    Interface builder: set the background to blue in interface builder or perform initialization in awakeFromNib

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

Sidebar

Related Questions

I am trying to create a small custom snippet for my C# code in
Trying to create a small monitor application that displays current internet usage as percentage
I'm trying to create a small Javascript framework that I can use in my
I'm trying to create a small html fragment (a div element) consisted of three
I'm trying to create a small web service to convert PDF files to a
I have a small assignment in C. I am trying to create an array
I'm trying to create a small application that interacts with the Product API of
I am trying to create a small function that returns the number of spaces
I'm trying to create a small web app that is used to remove items
I'm trying to create a small search for my site. I've tried using full-text

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.