Questions tagged [ibaction]

IBAction is a type qualifier used by Interface Builder to synchronize with Xcode.It is available in iOS 2.0 and later. The tags [UIButton] should be used to ask about Apple's UIKit frameworks UIButton action. Use the related tags [ios] , [UIButton] and [IBAction] for issues specific to those platforms.

IBAction is a macro defined to denote methods that can be referred to in Interface Builder.

As indicated in Apple's documentation, it is defined as void:

#define IBAction void

Relevant Stack Overflow question: IBOutlet and IBAction

891 questions
4
votes
1 answer

How to change language setting of MPMediaPickerController.

I'm creating a music App and I want to support multi languages of MPMediaPickerController. I programmed as follows: - (IBAction)pushedMusicButton:(id)sender { MPMediaPickerController *pickerController = [[MPMediaPickerController alloc]…
4
votes
1 answer

NSTextField call IBAction on text change

In visual studio there is an event called text_changed for text boxes, how can I create a similar event/Action in Cocoa? And in general how do you get these extra events for form controls? e.g. mouse over, in visual studio you just choose from a…
Charlie Egan
  • 4,878
  • 6
  • 33
  • 48
4
votes
3 answers

How to read button tag in IBAction?

I have button: ... UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; [rightButton setTitle:annotation.title forState:UIControlStateNormal]; rightButton.tag = myCustomNumber; [rightButton addTarget:self…
iWizard
  • 6,816
  • 19
  • 67
  • 103
4
votes
1 answer

IBAction - Why Declare them in the Header File

I notice that normal practice is to declare IBAction methods in the header file. I have also noticed that it is not necessary to do so for Interface Builder to recognise the IBAction methods and allow me to link them to controls. So what is the…
daveywc
  • 3,136
  • 7
  • 45
  • 58
4
votes
1 answer

Open native Twitter App from my Application using IBAction

I'd like to implement the natvie Twitter App into my iOS Application. I've already done that with Facebook by using the URL Schemes. But I weren't able to find such thing for Twitter. For Facebook I used: -(IBAction)facebook:(id)sender { …
Constantin Jacob
  • 488
  • 1
  • 8
  • 21
3
votes
2 answers

NSButton Multiple clicks

I have an IBAction of when the button is clicked to change my view. How can I handle multiple clicks for example if I click the button a second time to cause another action? Or do I need to delete the button after it has been clicked and then…
Grant Wilkinson
  • 1,088
  • 1
  • 13
  • 38
3
votes
1 answer

Using IBActions with UIButtons without IBOutlet

Sorry for the unclear title. I want to be able to add IBAction methods to a button I added in the following way: (.h class) { UIButton *button; } -(IBAction)ButtonReleased:(id)sender (.m class) { -(IBAction)ButtonReleased:(id)sender { …
rdelfin
  • 819
  • 2
  • 13
  • 31
3
votes
1 answer

Disable a button based on a label's value

I have a UILabel called label, and you can add or subtract 1 from it using two buttons. When you subtract all the way down to 0, I want the minus button to stop working. And if the value is added, I want the minus button to work again. Here is the…
3
votes
2 answers

IBAction methods in class extensions?

Is it good programming practice to define all (IBAction) methods associated with a NSViewController's .xib within a class extension?
tgma4stuff
  • 31
  • 2
3
votes
1 answer

Disable buttons after clicking a button

I am working on a quiz app and I need to find a way to disable specific buttons in my UIView controller when I press on the correct answer i.e a button. Is there a way to accomplish this? Relevant code: myButton.enabled = NO; but I do not have…
mat
  • 41
  • 1
  • 4
3
votes
1 answer

Swift @IBActions in ViewController Extension

I’ve noticed in Swift/Xcode 11 that you can’t ctrl-drag an IB object into a ViewController extension to create an IBAction, but you can cut/paste it into the ext. after ctrl-dragging to create the IBAction in the ViewController class & it works.…
Gallaugher
  • 1,593
  • 16
  • 27
3
votes
3 answers

Multiple UIButtons 1 function

Basically I need to have several buttons in a view. I would like them to all call one function so that I can keep track of a 'state'. How can I tell which button called the function? Is there anyway to get the text of the sender?
Critter
  • 462
  • 1
  • 3
  • 14
3
votes
1 answer

Anchor a function to UIButton programmatically

How can I anchor a function to my Button which I created this way button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.titleLabel.font = [UIFont systemFontOfSize: 12]; button.titleLabel.lineBreakMode =…
Csabi
  • 3,097
  • 17
  • 59
  • 107
3
votes
3 answers

UIBarButtonItem not triggering IBAction

I'm trying to create a UIBarButtonItem that opens the camera once the button has been tapped. For some reason, my takePicture(_sender:) function doesn't seem to be getting called. I originally tried to create my UIBarButtonItem using the Interface…
Mattkx4
  • 199
  • 3
  • 16
3
votes
1 answer

Multiple Parameters on an IBAction Function

I currently have a function that gathers a time from a database and returns it for other functions to use. It needs a parameter, which is stored in another part of the app, in order to gather the value from the database. My problem comes when I want…
bwc
  • 1,732
  • 1
  • 14
  • 27