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
3
votes
1 answer

Trigger button to change text in UITextView in swift3 xcode 8 ios 10

I'm new to xcode and am stuck on this problem, because after trying several sample code examples online, nothing works. Could you help me figure out what the problem is? My code below: import UIKit class ViewController: UIViewController { …
Alyak
  • 39
  • 1
3
votes
3 answers

Use a button on a HTML page to call xcode IBAction

This seems like a strange one. Not even sure if it is possible!! I have a UIWebView that loads a local html page. On this html page I have a button. I want to click on the button and then call an IBAction in Xcode. How would I go about this? Or can…
StefanHanotin
  • 191
  • 5
  • 17
3
votes
4 answers

Custom UITableViewCell and IBAction

I have a custom UITableViewCell on which I have added a button, I have associated that button on an IBAction in my viewController. Now the problem that i am facing is how do I know from which cell that button was created. When I present my…
Yogesh
  • 1,333
  • 3
  • 16
  • 35
3
votes
1 answer

Send action from NSTextField when on key up instead of return

I want to show the number of characters left for a new tweet, after a key has been lifted. Currently, this only happens if return is lifted: - (IBAction)updateCharacterCountFromNewTweetField:(id)sender { [newTweetCharacterCount setIntValue:140 -…
user142019
3
votes
0 answers

IBAction called in response to code interaction with UI element

In previous versions of iOS, IBActions were only triggered in response to user action. Now, it seems that they are also triggered by interactions through code on the same thread as the user interaction... I probably didn't word it that well, but…
ciauri
  • 513
  • 5
  • 13
3
votes
2 answers

Which IBAction referenced to which Button in Swift iOS development?

New to iOS development with Swift code. A previous developer has created 2 buttons and used the CTRL-drag-drop technique to generate the IBAction methods. The same as the buttons, he created two labels and two IBOutlet variables. Let's say that he…
O Connor
  • 4,236
  • 15
  • 50
  • 91
3
votes
1 answer

IBDesignable... adding custom actions?

I'm new to Xcode and I assume there's a way to do it but I can't seem to figure it out. I have made a custom control by subclassing UIView and using IBDesignable. However, I can't seem to figure out how to send events from within my control to a…
Daniel Radtke
  • 307
  • 2
  • 11
3
votes
4 answers

How can I disable a button for a few seconds after it is tapped

The following is the code for an IBAction I would like to disable for 5 seconds after it is clicked. @IBAction func postPressed(sender: AnyObject) { //var disableMyButton = sender as? UIButton //disableMyButton!.enabled = false …
James Chen
  • 387
  • 1
  • 4
  • 17
3
votes
1 answer

Apply an IBAction only to a single cell

I have a tableView with prototypes cell; with this func I set cell height override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { return cellHeight } with this action I change…
Fabio Cenni
  • 841
  • 3
  • 16
  • 30
3
votes
2 answers

NSComboBox - item selected action?

is there an IBAction for item selection in NSComboBox? I trying to define 2 different actions - one for item selected from the drop box, and another action for entering a new value. is that possible? *I'm doing a mac app, not iOS
Aviram Netanel
  • 12,633
  • 9
  • 45
  • 69
3
votes
3 answers

Using an IBAction method when it is not called from an action?

Are there any issues when using IBAction when it is not actually called from a user's action? If you have an action like -(IBAction)sayHello:(id)sender; You can call it from within your class like: [self sayHello:@"x"] The @"x" doesn't do…
cannyboy
  • 24,180
  • 40
  • 146
  • 252
3
votes
3 answers

Swift Unit Testing IBAction

I have a UIViewController that contains each of UITextField, UIButton and UILabel. I put something in the UITextField, press a button and the string is now capitalized in the UILabel. My question is: how do I set up the IBAction in Swift for unit…
noobsmcgoobs
  • 2,716
  • 5
  • 32
  • 52
3
votes
1 answer

How to change the background color of a UIButton when tapped in swift?

ViewController: UIViewController { @IBAction func like(sender: AnyObject) { like(backgroundColor!) = UIColor.greenColor() } } I want to chanage the color of UIbutton"like button" : White is the default "not tapped or unlike" green when…
JAMESMATHEO12
  • 55
  • 2
  • 4
3
votes
1 answer

When do we need button to send argument in Swift?

When connecting a button in Xcode as @IBAction func, we can choose between Arguments: Sender or None. When do we choose Sender and when None?
3
votes
3 answers

Using Interface Builder efficiently

I am new to iPhone and objective c. I have spent hours and hours and hours reading documents and trying to understand how things work. I have RTFM or at least am in the process. My main problem is that I want to understand how to specify where an…
twerdster
  • 4,977
  • 3
  • 40
  • 70