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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:27:05+00:00 2026-05-12T23:27:05+00:00

I’m sure I’m overlooking the obvious as I’ve got countless working buttons…but…for whatever reason

  • 0

I’m sure I’m overlooking the obvious as I’ve got countless working buttons…but…for whatever reason this one is not cooperating…

I’ve added a UIButton (Rounded Rect) to a UIView subclass (DialogView) which is a subview of my view controller’s view. This subview is created almost entirely in IB. I’ve wired up the button to (IBAction)okButtonPressed:(id)sender in IB to Touch Up Inside and created a corresponding method in DialogView. However when I “touch” this button it doesn’t trigger the method. userInteractionEnabled is true for the VC’s view, DialogView and the UIButton.

Thinking maybe initWithCoder had to do some frame manipulation or something I added the following which successfully logs to console.

- (id)initWithCoder:(NSCoder *)decoder {
    if (self = [super initWithCoder:decoder]) {
        NSLog(@"DialogView initWithCoder called");
    }
    return self;
}

In further exploration I wired up an IBOutlet to the button and then if I try to change the titleLabel from the view controller I notice that it get’s severely truncated. Default text of say “Press Me!” set in IB displays fine when view is first drawn. But if I change the text…

self.DialogView.okButton.titleLabel.text = @"Not Working";

…it gets truncated to “N…”

Dunno if this is related. Probably…

Anyone see what I’ve screwed up here?

Edit (adding code related to showing UIButton):

From the View Controller:

self.DialogView = [[[NSBundle mainBundle] loadNibNamed:@"DialogView" owner:self options:nil] objectAtIndex:0];; 
self.DialogView.myVC = self;
self.DialogView.backgroundColor = [UIColor clearColor];
self.DialogView.center = CGPointMake(self.view.frame.size.width / 2, self.view.frame.size.height / 2);
self.DialogView.nameLabel.text = loan.fullName;
self.DialogView.noteLabel.text = loan.summaryOfLoan;
self.DialogView.amountLabel.text = [currencyFormatter stringFromNumber:loan.originalAmount];
self.DialogView.alpha = 0.0;
[self.view addSubview:DialogView];

The UILabels all displaying as expected. As is the problem UIButton. I can see it I just can’t interact with it!?!

DialogView’s interface:

@class MyViewController;

@interface DialogView : UIView {
    IBOutlet UILabel *nameLabel, *noteLabel, *amountLabel;
    IBOutlet UIImageView *arrowView;
    IBOutlet UIButton *okButton;
    MyViewController *myVC;
}

@property (nonatomic, retain) UILabel *nameLabel, *noteLabel, *amountLabel;
@property (nonatomic, retain) UIImageView *arrowView;
@property (nonatomic, assign) MyViewController *myVC;
@property (nonatomic, retain) UIButton *okButton;

- (IBAction)okButtonPressed:(id)sender;

@end

And DialogView’s implementation:

#import "DialogView.h"
#import "MyViewController.h"

@implementation DialogView

@synthesize nameLabel, noteLabel, amountLabel, arrowView, okButton;
@synthesize myVC;

- (void)dealloc {
    [nameLabel release];
    [noteLabel release];
    [amountLabel release];
    [arrowView release];
    [okButton release];
    [super dealloc];
}

- (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        // Initialization code
    }
    return self;
}

- (id)initWithCoder:(NSCoder *)decoder {
    if (self = [super initWithCoder:decoder]) {
        NSLog(@"DialogView initWithCoder called");
    }
    return self;
}

- (IBAction)okButtonPressed:(id)sender {
    NSLog(@"pressed DialogView OK button");
    [self.myVC.navigationController popViewControllerAnimated:YES];
}

- (void)drawRect:(CGRect)rect {
    // Drawing code
}


@end
  • 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-12T23:27:06+00:00Added an answer on May 12, 2026 at 11:27 pm

    I thought that we should use -setTitle:forState: in order to set button’s title ?

    An other thought, did you check that the button’s frame is not CGRectZero ? And by the way, all the frames for the view in the hierarchy ? And check that one superview in the hierarchy is not user interaction disabled ?
    And, I think imageView does not respond to touches, do you have one in your code ?

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

Sidebar

Ask A Question

Stats

  • Questions 242k
  • Answers 242k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Two ways: Restrict the path of the cookie to only… May 13, 2026 at 7:36 am
  • Editorial Team
    Editorial Team added an answer Any image stored to the iPhone Photo albums on simulator… May 13, 2026 at 7:36 am
  • Editorial Team
    Editorial Team added an answer Do you still have a StartupUri specified in the XAML?… May 13, 2026 at 7:36 am

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I've got a string that has curly quotes in it. I'd like to replace
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want use html5's new tag to play a wav file (currently only supported
In order to apply a triggered animation to all ToolTip s in my app,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.