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
6
votes
2 answers

ViewController's outlet view first non-nil, then nil when loading from bundle

I am loading a UIViewController from a bundle with initWithNibName:bundle:. If I set a breakpoint in its viewDidLoad I can see that its view is set. I can also see this when viewing About.xib in the Interface Builder. However once the view is…
Drux
  • 11,992
  • 13
  • 66
  • 116
6
votes
2 answers

IBOutlets Strong or Weak - Does it Actually Make a Difference to Memory Management? (ARC)

I've been reading a lot recently on here and other sites about whether IBOutlets should be strong or weak. The official verdict is that they should be weak, except for when they reference top level xib objects. This is fine. However what I don't…
GuybrushThreepwood
  • 5,598
  • 9
  • 55
  • 113
6
votes
3 answers

Assigning a IBOutlet in Objective-C

The code generator Accessorizer has an option to assign IBOutlets rather than retaining them. For example, compare these two generated lines: @property(nonatomic,retain)IBOutlet UIImageView *backgroundView; @property(nonatomic,assign)IBOutlet…
Casebash
  • 114,675
  • 90
  • 247
  • 350
6
votes
2 answers

iOS >> prepareForSegue >> IBOutlet Update Doesn't Work?

I'm trying to update a Label in the 2nd VC from the 1st VC within the prepareForSegue method. -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { MYSecondViewController* secondVC =…
Ohad Regev
  • 5,641
  • 12
  • 60
  • 84
6
votes
2 answers

When does an IBOutlet initialize?

I set up an outlet for a text view via Interface Builder. The text view loads fine, however I can't access any of the properties of it programmatically because the outlet is always nil. When does it instantiate? Even after my…
Hovanky
  • 303
  • 1
  • 3
  • 15
6
votes
4 answers

How do I connect a IBOutlet to a UIView?

I'm trying to switch views after an animation as seen: [UIView beginAnimations: @"Fade Out" context:nil]; [UIView setAnimationDelay:1.0]; [UIView setAnimationDuration:0.25]; splash.alpha = 0.0; [UIView commitAnimations]; [self.view addSubview :…
Jon Sullivan
  • 399
  • 2
  • 5
  • 11
6
votes
4 answers

Why is my IBOutlet being released under ARC?

The Problem An IBOutlet is released before I have a chance to use it. What I Want I want to access a navigation controller from my app delegate so I can reload a table view. My Setup I have: A Main.xib that's set as my main interface in target…
5
votes
2 answers

How to add objects to IBOutletCollection?

I declared NSArray in my class NSArray *labelsArray; I made it a property @property (nonatomic,retain) IBOutletCollection(UILabel) NSArray *labelsArray; I connected it to four UILabels in IB. I allocated the array. When i do…
Andrey Chernukha
  • 21,488
  • 17
  • 97
  • 161
5
votes
3 answers

EXC_BAD_INSTRUCTION when synthesizing @property (weak) IBOutlet NSWindow *window

I'm a newbie to ObjC/Cocoa and Mac development in general, and toying with the basics. The simplistic default template for a new Cocoa application in Xcode 4.2 on Lion looks like this: // AppDelegate.h #import @interface AppDelegate…
JK Laiho
  • 3,538
  • 6
  • 35
  • 42
5
votes
1 answer

How Do I Access IBOutlets From Other Classes in Objective-C?

How do I access IBOutlets that have been created in another class? For example, if I have an IBOutlet in Class A how can I access in Class B? If I can not access IBOutlets from other classes what is a work-around?
Blake
  • 53
  • 1
  • 3
5
votes
1 answer

How to connect outlets and actions in Swift / MacOS programaticly

I have a simple example. I connected the left button1 and label1 with ctrl-draging it to the contollerclass. How can I do the same for the right button2 label2 programaticly (without ctrl-draging) That´s my code: class ViewController:…
mica
  • 3,898
  • 4
  • 34
  • 62
5
votes
6 answers

Swift ios connect multiple items to the same IBOutlet

I wonder if its OK to connect multiple items to the same IBOutlet? In my tableView I have setup two cells and given them a uniqe identifier. But I have connected the label in each cell to the same IBOutlet in my custom UITableViewCell class. class…
user2636197
  • 3,982
  • 9
  • 48
  • 69
5
votes
2 answers

Changing the State of a Button from Another Class

This is my goal: When the Start button is tapped, I want the Send buttons to be enabled. The following is what my view controller looks like when loaded: As you can see, the Send buttons are disabled, which is desired. And I've disabled it by…
aejhyun
  • 612
  • 1
  • 6
  • 19
5
votes
0 answers

Access an IBOutlet from another class in Swift

I'm new to Swift and Mac App. So I'm writing an Mac App today and I still confuse how to access an IBOutlet from another class after searching a lot. I'm using StoryBoard and there are two NSTextField path mirror in my ViewController. I have created…
Austere.J
  • 51
  • 2
5
votes
2 answers

Accessing IBOutlet from another class

I am calling a class function from my ViewController class like this: Buttons.set_cornerRadius(10) I have another .swift file where I have the function declared: class Buttons { class func set_cornerRadius(radius: CGFloat) { …
smnk
  • 471
  • 1
  • 6
  • 25