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
14
votes
7 answers

Pass different parameters to an IBAction

My iPhone app has many buttons and I want all the buttons to call the same method, but with different parameters. For example I want tapping one button to call the method myMethod: with the argument @"foo", and a second button should call the same…
ahmed
  • 14,316
  • 30
  • 94
  • 127
13
votes
3 answers

How to use Gesture Recognizers in IB (iPhone/iPad)?

I have just discovered the Gesture Recognizers in IB and I would like to make use of them. I've tried out the Tap Gesture Recognizer however it doesn't seem to work. Here is what I've done... Dragged and dropped the 'Tap Gesture Recognizer' into my…
13
votes
2 answers

Action when pressing return key on keyboard (iOS)

- (BOOL)textFieldShouldReturn:(UITextField *)textField { [self checkRun:nil]; return YES; } I'm trying to complete the IBAction checkRun when the return key is pressed, by using the above code, but it doesn't seem to be working. Where am I…
Nathan
  • 155
  • 1
  • 2
  • 5
11
votes
4 answers

How to define which button pressed if they both have same IBAction?

I have two UIButtons (I create them using IB), which connected to File's owner with the same IBAction, how can i define which of them are pressed?
Tunyk Pavel
  • 2,473
  • 6
  • 31
  • 46
11
votes
5 answers

UIButton event 'Touch Up Inside' not working. 'Touch Down' works fine

I've got a UIButton in a UIView, which is in a UIViewController that I've allocated and inited from a .xib file. When hooking an IBAction up to the 'Touch Down' event of a UIButton it triggers correctly. But if I hook it up to the 'Touch Up Inside'…
Rich Brooks
  • 521
  • 1
  • 6
  • 17
11
votes
2 answers

Are IBActions fired on main queue?

I tried to search this out, but kinda stuck in this question. All guides about UI say, that all UI stuff should be on GCD main thread, but no one says about inner implementation of IBActions. So, are IBActions fired on GCD main thread or not?
htzfun
  • 1,231
  • 10
  • 41
10
votes
2 answers

How to connect an IBOutlet and IBAction to a View Controller without using the Assistant editor

I know the second button here shows the Assistant editor: And I know how to make an Outlet and Action by Control dragging from an object in the Interface Builder to the View Controller code. Ideally it should be as easy as the documentation makes…
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
10
votes
2 answers

Create IBOutlets and IBActions programmatically

I want to create IBOutlets and IBActions in code rather than with the interface builder. Let's say I've got a button on my UI called btnDisplay, and a method in my code called displayMessage. What would be the code I'd have to write to make it so…
user3705416
  • 115
  • 1
  • 5
10
votes
1 answer

Indeterminate NSProgressIndicator will not animate

So I've got a simple UI, A Start button, some text/labels, and a progress bar. When the Start button is click, the NSProgressIndicator should animate. Here's my code: @synthesize progressBar = progressBar; /* Some code and setup stuffs... */ -…
Ech0riginal
  • 329
  • 1
  • 3
  • 7
10
votes
4 answers

IBAction UIButton firing is delayed

I have a UIButton connected to an IBAction in Interface Builder. The Problem: The action firing and the de-highlight of the button both take a little bit to happen. The Facts: View structure: View 10 Buttons (connected via…
Natan R.
  • 5,141
  • 1
  • 31
  • 48
9
votes
5 answers

How to implement two IBActions in UIButton without overlap?

I drag 2 IBActions from a UIButton, one with touchDown event and second with drag Inside. - (IBAction)clickButton:(UIButton *)sender { NSLog(@"Click Button"); } - (IBAction)dragInsideButton:(UIButton *)sender { NSLog(@"Drag Button"); } But…
Alex
  • 1,161
  • 1
  • 8
  • 15
8
votes
2 answers

What would be better strategy for IBActions in protocols in Swift?

I am creating a Swift project and I want to define a specific protocol that enforces other components to implement a animate method: protocol AnimatableBehavior { @IBAction func animate() } The problem is I want this method to be an IBAction,…
Angel G. Olloqui
  • 8,045
  • 3
  • 33
  • 31
8
votes
2 answers

Can you hard code IBActions and IBOutlets, rather than drag them manually in Interface Builder?

Is it possible to to hard code the IBActions and IBOutlets in code, instead of drag-connecting them in Interface Builder?
daihovey
  • 3,485
  • 13
  • 66
  • 110
8
votes
3 answers

IBAction not being called

I am building an app with interface builder for the iPad. The scroll view takes up most of the screen except for a small portion at the bottom. Scrolling is enabled downwards. In the small portion on the bottom (not inside the scrollview), there is…
thebiglebowski11
  • 1,451
  • 10
  • 41
  • 76
7
votes
1 answer

Correct way to setup target/action for NSMenuItem in Cocoa?

I'm having some real difficulty with some initial Cocoa programming I am carrying out. Essentially, I have an NSStatusBar item with an NSMenu attached as the menu. The menu has a single NMMenuItem. In IB I have connected the NSMenuItem to an…
Edwardr
  • 2,906
  • 3
  • 27
  • 30
1
2
3
59 60