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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:08:45+00:00 2026-06-04T04:08:45+00:00

I am trying to print . when I press on a button that shows

  • 0

I am trying to print “.” when I press on a button that shows “.”

Basically I wanna grab “.” on NSString format

So if I do

NSString *dec = [sender currentTitle];

it just crashes when I try to run.

  • 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-04T04:08:47+00:00Added an answer on June 4, 2026 at 4:08 am

    In Cocoa, all controls send notifications that they have been operated, by using a target-action mechanism. The ‘target’ is any other object and the ‘action’ is any selector that that object responds to. Buttons are no different.

    So you can, for example, define:

    -(void)buttonClicked:(id)sender {
      NSLog(@"Button was clicked!");
    }
    

    You’d hook that up to the button’s target-action, by invoking -setTarget: and -setAction: accordingly. The target will be self, if you’re doing this from inside the class that handles the action:

    [button setTarget:self];
    [button setAction:@selector(buttonClicked:)]
    

    Now when the button is pressed, you’ll get a NSLog() output in the console.

    To update the value of a label instead of printing something with NSLog(), you can probably figure that out, but:

    -(void)buttonClicked:(id)sender {
      [label setText:@"."];
    }
    

    You should read Apple’s documentation, which covers this stuff in great detail.

    https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/CommunicateWithObjects.html#//apple_ref/doc/uid/TP40002974-CH7-SW14

    PS: stackoverflow is for all programming languages, so make sure to tag your questions with the relevant programming language.

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

Sidebar

Related Questions

I am trying to print a report that contains a bar graph using the
i am trying to draw a rectangle when i press mouse left button and
Im trying print Excel file data on a page. To do it i used
Im trying to print the realtime output based on user input for a search.
I'm trying to print the output of function only when it is true but
I am trying to print invoice. But top whatever i do to setting margins,
I am trying to print a portion of the page in FF3. This works
I am trying to print 1 if there are at least two of the
I'm trying to print characters in the console at specified coordinates. Up to now
I'm trying to print the second member variable of all items in an stl

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.