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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:15:43+00:00 2026-06-18T15:15:43+00:00

In my subclass of UIView (which I have instantiated in Interface Builder), has a

  • 0

In my subclass of UIView (which I have instantiated in Interface Builder), has a couple buttons as subviews that I add to my view in the initWithCoder method like so:

theButton = [UIButton buttonWithType:UIButtonTypeCustom];
            [theButton setFrame:CGRectMake([UIScreen mainScreen].bounds.size.height-150-10, 289, 150, 21)];
            [theButton.titleLabel setTextAlignment:UITextAlignmentRight];
            [theButton setOpaque:YES];
            [theButton.titleLabel setFont:[UIFont fontWithName:@"MyFont" size:32.0]];
            [theButton.titleLabel setTextColor:[UIColor redColor]];
            [theButton.titleLabel setText:@"text"];
            [self addSubview:theButton];
            [theButton addTarget:myTarget action:@selector(pause) forControlEvents:UIControlEventTouchUpInside];

But the button will not draw as it is supposed to. If I set a breakpoint in drawRect:, and po [self subviews] with llvm, I get this output.

$0 = 0x0c93e860 <__NSArrayM 0xc93e860>(
<UIButton: 0xc93d910; frame = (10 289; 150 21); alpha = 0.5; layer = <CALayer: 0xc93d4a0>>,
<UIButton: 0xc93e2d0; frame = (408 289; 150 21); layer = <CALayer: 0xc93e390>>
)

So why isn’t my button showing up?

Edit: my superview’s recursiveDescription:

<UIView: 0xa46b220; frame = (0 0; 320 568); transform = [0, -1, 1, 0, 0, 0]; autoresize = RM+BM; layer = <CALayer: 0xa46b280>>
   | <MyView: 0xa168710; frame = (0 0; 568 320); autoresize = W+H; layer = <CALayer: 0xa1687d0>>
   |    | <UIButton: 0xa16c160; frame = (10 289; 150 21); alpha = 0.5; layer = <CALayer: 0xa16bcc0>>
   |    |    | <UIButtonLabel: 0xa16c3e0; frame = (0 0; 0 0); clipsToBounds = YES; hidden = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0xa16c480>>
   |    | <UIButton: 0xa16cb00; frame = (408 289; 150 21); layer = <CALayer: 0xa16cbc0>>
   |    |    | <UIButtonLabel: 0xa16c7e0; frame = (0 0; 0 0); clipsToBounds = YES; hidden = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0xa16c880>>
  • 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-18T15:15:44+00:00Added an answer on June 18, 2026 at 3:15 pm

    Well, my guess is that your button is showing up, but you made it a custom button with no text for the normal state (and because you are not using any background image or color, it seems invisible).

    UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setTitle:@"Text" forState:UIControlStateNormal];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a simple subclass of UIView which has a few subviews but
I have a UIView subclass ( CustomView for purposes of this question) that has
I want to have a UIView subclass that has a border image, but I
I have a subclass of UIView in which I've added some subviews to in
I have a UIView subclass. This subclass has multiple subviews. Is it possible to
I have a UIViewController subclass to control a UIView that I want to add
I have a subclass of UIView that's instantiated in a XIB file. I need
I have a UIView subclass which currently assembles itself completely programatically. It has a
I have a UIView subclass which in turn has a contentView, declared as such
i have created a custom view class which is a subclass of UIview class

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.