• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: UIButton label
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UIButton label


  • Subject: Re: UIButton label
  • From: Dave DeLong <email@hidden>
  • Date: Tue, 27 Oct 2009 13:49:59 -0600

Because the proper way to set the text of a UIButton is setTitle:forState:

Looking at the documentation, it looks like "button.titleLabel.text" is for querying what the title happens to be at the time (without knowing the state).

Dave

On Oct 27, 2009, at 1:43 PM, DKJ wrote:

I'm having a ridiculous amount of trouble changing the text of a UIButton title. I have the button connected to the file's owner (a UIViewController) in IB, and I've defined this property:

    @property(nonatomic,retain) IBOutlet UIButton *button;

The button's action method works, so I know the connections are OK. I put this in the controller's viewWillAppear: method:

    self.button.titleLabel.text = @"Why won't this work?";

and the button remains blank. (No text is set for the button in IB.) I've put an NSLog in the viewWillAppear: method, so I know it's being called.

Why won't this work?

dkj

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >UIButton label (From: DKJ <email@hidden>)

  • Prev by Date: Re: UIButton label
  • Next by Date: Re: Mysterious crash in objc_msgSend in GC app
  • Previous by thread: Re: UIButton label
  • Next by thread: Odd window behavior LSUIElement=1
  • Index(es):
    • Date
    • Thread