Questions tagged [iboutlet]

The type qualifier IBOutlet is a tag applied to an instance-variable declaration so that the Interface Builder application can recognize the instance variable as an outlet and synchronize the display and connection of it with Xcode.

An outlet is an object instance variable — that is, an instance variable of an object that references another object. With outlets, the reference is configured and archived through Interface Builder. The connections between the containing object and its outlets are reestablished every time the containing object is unarchived from its nib file. The containing object holds an outlet as an instance variable with the type qualifier of IBOutlet.

Example:

IBOutlet NSArray *keywords;

Because it is an instance variable, an outlet becomes part of an object’s encapsulated data. But an outlet is more than a simple instance variable. The connection between an object and its outlets is archived in a nib file; when the nib file is loaded, each connection is unarchived and reestablished, and is thus always available whenever it becomes necessary to send messages to the other object. The type qualifier IBOutlet is a tag applied to an instance-variable declaration so that the Interface Builder application can recognize the instance variable as an outlet and synchronize the display and connection of it with Xcode.

903 questions
3
votes
1 answer

Having Trouble Making a Button in Xamarin.Mac/XCode-Storyboard

Let me start off by saying I am new to XCode, but already very experienced in C#. I am having trouble getting the outlet for this button, and every time I try to Control drag it under ViewControl it only lets me do action! I have been googling for…
Sean Mitchell
  • 447
  • 2
  • 21
3
votes
2 answers

xcode: class is not key value coding-compliant

I'm currently working myself through this tutorial: https://developer.apple.com/library/content/referencelibrary/GettingStarted/DevelopiOSAppsSwift/ConnectTheUIToCode.html#//apple_ref/doc/uid/TP40015214-CH22-SW1 After creating the function for the…
Ginso89
  • 139
  • 1
  • 4
  • 9
3
votes
3 answers

"No @implementation found for the class" error in Storyboard in Swift

I'm trying to create in IBOutlet in Swift using my Storyboard and assistant editor, but I'm receiving a strange error I've never seen before. Looks Objective-C-ish. I navigated to my ViewController's Save button in my Storyboard Then I…
Chewie The Chorkie
  • 4,896
  • 9
  • 46
  • 90
3
votes
4 answers

iPhone - Cannot access to an IBOutlet (nil valued)

I have a problem accessing a IBOutlet. I have a NIB inside which there is a tableview, a toolbar and an UILabel (encapsulated into a view). The controller (that is the file's owner) is defined as: @interface ChoixPeriodeController : UIViewController…
Oliver
  • 23,072
  • 33
  • 138
  • 230
3
votes
5 answers

Why doesn't Xcode make outlets unowned instead of weak?

Xcode produces outlets as weak vars with implicit unwrapping, like this: @IBOutlet weak var nameTextField: UITextField! I wonder why it didn't just make onowned var, which - in my understanding - behaves exactly the same, but keeps the type…
Robo Robok
  • 21,132
  • 17
  • 68
  • 126
3
votes
3 answers

Get an outlet variable by name

Looking for a way to access an outlet programmatically in swift: @IBOutlet var label1: UILabel? var outletName = "label1" view[outletName].text = "hello, world!" Is the only way to do this to create my own custom mapping, like so? @IBOutlet var…
Rawr
  • 2,206
  • 3
  • 25
  • 53
3
votes
1 answer

Using a typealias when declaring an IBOutlet

For teaching purposes, I'd like to be able to hide the complexity of optionals (which I will explain in the following lessons) from students on their first task. I would also, however, want them to play with the interface and connect both functions…
olivaresF
  • 1,369
  • 2
  • 14
  • 28
3
votes
2 answers

IBOutlet is nil

I have created a standard outlet for a view that will hold different information based on the button selected on the previous screen. @IBOutlet weak var labelView: UIView! It shows it is connected in both the story board view and on the code…
Danickar
  • 85
  • 7
3
votes
3 answers

Swift - Custom View with xib file, IBOutlet is nil

I have a custom button designed using xib file like this: and I connect it to my storyboard like this: but when I run the app, I got runtime error complaining that IBOutlet ivRightIcon is nil @IBInspectable var rightIcon: UIImage? = nil{ …
Hoang Trung
  • 263
  • 4
  • 15
3
votes
2 answers

TabBarController's second tab doesn't get instantiated -> IBOutlets are nil

I'm creating a simple app which has a tab bar controller where the summary is one tab and the history is another. In the summary tab, there is a button to add a new round. Whenever this round gets added it has to go to the history tab as well. I'm…
3
votes
1 answer

Why does "File's Owner" sometimes have a "view" outlet? Can I add my own?

When I create a new "Cocoa Class", of type NSViewController, and check "Also create XIB file for user interface", I get a blank xib file. Its "File's Owner" has an outlet "view" which is connected to the custom view. When I create a new "View" (xib…
Naha
  • 105
  • 7
3
votes
2 answers

Dynamically reference an IBOutlet in Swift?

I have a view controller with 100 IBOutlets that I want to hide or display depending on whether the name of that IBOutlet is found as a key in Dictionary. How on earth do I do this? My intuition points me to for item in Dict { // try to refer…
bflora2
  • 733
  • 3
  • 8
  • 26
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

Swift. Changing multiple UIButtons with IBOutlet

So, I have 20 UI buttons on a single viewcontroller. I also have 2 other buttons there that will change the currentTitle or background color of different groups of those buttons. (for example, pressing one of those 2 buttons will change the color of…
3
votes
3 answers

Can't make outlet to custom class from UITableViewCell

I am unable to make an @IBOutlet to my custom class from the elements in my prototype cell. I tried dragging from the element to the class; I let go of the blue line, and nothing happens. Here are my files if you want to poke around. Thanks in…
atirit
  • 1,492
  • 5
  • 18
  • 30