iboutlet

Xcode 4 - Connecting Outlets

狂风中的少年 提交于 2019-12-04 16:46:31
问题 This page shows how easily I can connect outlets http://developer.apple.com/technologies/tools/whats-new.html in Xcode 4, but I can't get it. I right click and drag an outlet from the new referencing outlet circle, and into my header where the object is declared, but nothing happens. Has anyone used this? Thanks a lot 回答1: I had the same problem with the final version of Xcode 4 and solved it by selecting the File's Owner Custom Class before using the drag & drop outlet feature like shown on

Should IBOutlets be ivars or properties?

霸气de小男生 提交于 2019-12-04 12:18:42
问题 Though I'm sure they exists, I'm having difficulties finding or pinning down an official best practice for declaring outlets in a ViewController. There are 3 options so far as I can see: ivar only property only property backed with an ivar Xcode currently crashes when I try and auto-generate a property by dragging into my ViewController from IB, but from what I remember, doing so creates a property without an ivar. It is also possible to drag into the ivar section and this will create an ivar

When does an IBOutlet initialize?

南笙酒味 提交于 2019-12-04 08:58:32
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 applicationDidFinishLoading gets called, it's still not "alive" or unarchived. An outlet doesn't instantiate because an outlet is a variable (or property). The objects in a nib are instantiated when that nib is loaded, and they are assigned to each outlet as immediately as possible afterward, after the objects are created but before awakeFromNib is sent to all relevant

Multiple IBOutlets in same line of same type in Swift

依然范特西╮ 提交于 2019-12-04 06:40:38
问题 In objective c you can declare IBOutlets in below mentioned manner: IBOutlet UIButton *btn1, *btn2, *btn3; And you can able to bind these buttons in storyboard. Now I want to use the same terminology in Swift. I want to declare these 3 buttons in same line rather than declaring these in 3 different lines. I can be able to declare these buttons in Swift as well using: @IBOutlet var btn1, btn2, btn3: UIButton! But my problem is I can only able to bind "btn1" in storyboard. "btn2" & "btn3" are

Can I connect multiple objects with different tags to the same IBOutlet?

拥有回忆 提交于 2019-12-04 04:50:42
I have 30 buttons in one view in Interface Builder. Each has a different tag between 100001 and 100030. I've found it easy to use the same action for each button, passing along the tag for each one when pressed and using code to decide which level to load. I want to connect all the buttons to a single IBOutlet, but have each button load a different image based on the user's saved data and the button's tag. How do I do this? Use IBOutletCollection to add an outlet collection to your view controller, like this: @property (retain, nonatomic) IBOutletCollection(UIButton) NSMutableSet* buttons;

How to link ibOutlet from subview to custom UIView Class in storyboard xcode

岁酱吖の 提交于 2019-12-04 00:19:10
I think this image explains it all. I have a subclass of UIView that I've entered into the class field. I'm trying to connect ibOutlets between the storyboard and class implementation. It's not giving me an error, but it's not working either. Is this another xcode bug, or am I expecting this to work in a way that it won't? Here is a solution: 1) Type an IBOutlet by hands in your header file, example : @property (strong, nonatomic) IBOutlet ProgressBarElementView *targetProgressElement; 2) Drag the pin from the code to the element in document outline zone I have the same problem.. I saw that if

IBOutlet instances are (null) after loading from NIB

随声附和 提交于 2019-12-04 00:12:35
I am working on an iPhone app and am getting (null) references to IBOutlet fields in my controller. I have a UIViewController subclass that is set as the File's Owner in my XIB. I have a set of UI elements that are wired into the controller. After loading from NIB and attempting to set properties on those UI elements, I find that they are (null). To clarify, some code: ExpandSearchPageController.h: @interface ExpandSearchPageController : UIViewController { IBOutlet UITextView * completeMessageView; } -(void)checkTextField; @property (nonatomic, retain) IBOutlet UITextView * completeMessageView

Objective-C Custom Class Actions and Outlets

雨燕双飞 提交于 2019-12-03 21:36:34
I am attempting to create a custom subclass of a UIView as follows: I created a .xib with a UIView that contains a Picker object and Toolbar object, hooked up the Outlets and actions. CustomPickerView.h #import <UIKit/UIKit.h> @interface CustomPickerView : UIView @property (strong, nonatomic) IBOutlet UIDatePicker* datePicker; @property (strong, nonatomic) IBOutlet UIBarButtonItem* doneButton; -(IBAction) buttonDonePush:(id)sender; @end CustomPickerView.m #import "CustomPickerView.h" @implementation CustomPickerView -(id) init { self=[[[NSBundle mainBundle] loadNibNamed:@"CustomPickerView"

Interface Builder won't allow connections to custom UIView class?

吃可爱长大的小学妹 提交于 2019-12-03 20:01:27
问题 Using Xcode 4.3.3, I can't figure out how to connect outlets in a custom UIView class with objects created in Interface Builder. In one ViewController, I have a variety of buttons, sliders, etc that I'm trying to group into Views. So, within that ViewController in IB, I added 3 views. Only 1 view will be visible at any given time. I derived custom UIView classes to handle each of these 3 views. My view controller instantiates each of the classes. I selected the view(s) in IB, opened the

Changing text of Swift UILabel

廉价感情. 提交于 2019-12-03 14:51:17
问题 I am attempting to learn Apple's Swift. I was recently trying to build a GUI app, but I have a question: How do I interact with GUI elements of my app? For instance, I used interface builder to make a UILabel, and I connected it to my viewcontroller by control-clicking, so that I get the @IBOUTLET thing. Now, how do I, while in my view controller, edit the text of this UILabel? To state it another way, what code can I use to programatically control the text of something on my storyboard? All