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
167
votes
11 answers

IBOutlet and IBAction

What is the purpose of using IBOutlets and IBActions in Xcode and Interface Builder? Does it make any difference if I don't use IBOutlets and IBActions? Swift: @IBOutlet weak var textField: UITextField! @IBAction func buttonPressed(_ sender: Any)…
suse
  • 10,503
  • 23
  • 79
  • 113
101
votes
9 answers

Gesture recognizer and button actions

I have a view hierarchy that looks something like this: UIView (A) UIView > UIImageView UIView > UIView (B) UIView > UIView (B) > Rounded Rect Button UIView > UIView (B) > UIImageView UIView > UIView (B) > UILabel I've attached gesture…
Mustafa
  • 20,504
  • 42
  • 146
  • 209
77
votes
2 answers

UIButton events. What's the difference?

I've encountered a problem where my button should remain "pressed down" while it shows popover called from it. Popover is selector for some filter and filter is shown on button itself. When I tap on it and it shows popover it becomes deselected no…
Protheus
  • 3,068
  • 4
  • 17
  • 25
69
votes
15 answers

How to hide tab bar with animation in iOS?

So I have a button that is connected to a IBAction. When I press the button I want to hide the tab bar in my iOS app with a animation. This [self setTabBarHidden:hidden animated:NO]; or this [self.tabBarController setTabBarHidden:hidden…
b3rge
  • 4,959
  • 7
  • 23
  • 24
38
votes
6 answers

Objective C: what is a "(id) sender"?

In some IBAction I saw: - (IBAction)pushButton:(id)sender; This (id)sender when do I use it?
cyclingIsBetter
  • 17,447
  • 50
  • 156
  • 241
36
votes
7 answers

IOS: one IBAction for multiple buttons

In my project I must control action of 40 buttons, but I don't want to create 40 IBAction, can I use only a IBAction, how?
cyclingIsBetter
  • 17,447
  • 50
  • 156
  • 241
33
votes
2 answers

What's the best way to call an IBAction from with-in the code?

Say for instance I have an IBAction that is hooked up to a UIButton in interface builder. - (IBAction)functionToBeCalled:(id)sender { // do something here } With-in my code, say for instance in another method, what is the best way to call…
iwasrobbed
  • 46,496
  • 21
  • 150
  • 195
25
votes
4 answers

Naming conventions on IBAction functions

I am doing another iOS application and I wonder if there are any naming conventions or good practices on how to name actions that I could follow. I am thinking of names on the functions that are invoked when user e.g. touches a button.
LuckyLuke
  • 47,771
  • 85
  • 270
  • 434
21
votes
13 answers

how to access from UICollectionViewCell the indexPath of the Cell in UICollectionView

i want to animate the UICollectionViewCell when action is called. i have done UICollectionViewCell in Interface Builder, the UICollectionView also. Now i want to get the correct indexPath at my actionBtnAddToCard method. thats the way i try it now…
brush51
  • 5,691
  • 6
  • 39
  • 73
19
votes
2 answers

IBAction inside UITableViewCell not called in iOS 9

I have a custom UITableViewCell subclass which contains a few IBAction methods wired up from a nib. Under iOS 8 everything works as expected. If the user taps one of the buttons, the appropriate IBAction is called. If the user taps anywhere else on…
Chad Pavliska
  • 1,233
  • 12
  • 17
18
votes
10 answers

How to access IBOutlets declared in superclass?

I'm currently refactoring a couple of view controllers that share a few IBOutlets and IBAction methods. I moved the outlet declarations and the IBAction method into a superclass, cutting these out of the subclasses. Now, when I open up Interface…
Sam Ritchie
  • 10,988
  • 4
  • 42
  • 53
16
votes
5 answers

Multiple UIAlertView; each with their own buttons and actions

Im creating a view in Xcode 4.3 and im unsure how to specify multiple UIAlertView's that have their own buttons with separate actions. Currently, my alerts have their own buttons, but the same actions. Below is my code. -(IBAction)altdev { …
DiscoveryOV
  • 1,045
  • 2
  • 9
  • 24
16
votes
2 answers

Programmatically generating UIButtons and associate those with IBAction

How do I do if I want to programatically generate a set of buttons and then associate those with IBActions? It's easy if I add the buttons in Interface Builder, but that I cannot do for this case.
Nicsoft
  • 3,644
  • 9
  • 41
  • 70
15
votes
4 answers

Xcode 8 drag and connect @IBAction incorrectly adds "WithSender" on connection inspector IB

Xcode 8 drag and connect @IBAction incorrectly adds "WithSender" on connection inspector IB Therefore I have to rename the methods to something like @IBAction func tappedConfirmButtonWithSender(sender: AnyObject) {} Shouldn't it be?: @IBAction…
moyoteg
  • 351
  • 3
  • 11
15
votes
8 answers

Swift - call @IBAction method in viewDidLoad without parameter

@IBAction func getNewPhotoAction(sender: AnyObject) { println("getNewPhotoAction") } override func viewDidLoad() { super.viewDidLoad() self.getNewPhotoAction(sender: AnyObject) // Error } I just want to call the getNewPhotoAction…
hahaha
  • 1,379
  • 4
  • 11
  • 22
1
2 3
59 60