• 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
Getting access to the name of a button?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting access to the name of a button?


  • Subject: Getting access to the name of a button?
  • From: "Frank Bettger" <email@hidden>
  • Date: Fri, 14 Sep 2007 12:28:08 +0200

I've created a very simple application with just one button called "Button
A" and I connected it to the action "myLog:" inside the AppController (I
created the AppController by sub classing NSObject and I added the action
myLog: using the IB. I then instantiated AppController and Control-dragged
from the button to the AppController instance).
The AppController has just one method that looks like this.

- (IBAction)myLog:(id)sender
{
    //NSLog(@"myLog activated");
    NSString *myString=[sender stringValue];
    NSLog(@"%@", myString);
}

When I run it and click repeatably on the button "Button A" this is what I
get in the log window

[Session started at 2007-09-14 12:19:23 +0200.]
2007-09-14 12:19:29.660 Logger[482] 1
2007-09-14 12:19:30.676 Logger[482] 0
2007-09-14 12:19:31.708 Logger[482] 1
2007-09-14 12:19:32.291 Logger[482] 0

I was hoping that [sender stringValue] would return the name of the button,
that is "Button A", but it gives alternating 1s and 0s. What's the
explanation?

Thanks Frank
_______________________________________________

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

  • Follow-Ups:
    • Re: Getting access to the name of a button?
      • From: apparao <email@hidden>
  • Prev by Date: NSWindow contentView buffer
  • Next by Date: Re: Getting access to the name of a button?
  • Previous by thread: NSWindow contentView buffer
  • Next by thread: Re: Getting access to the name of a button?
  • Index(es):
    • Date
    • Thread