IBOutlets are initialized during view loading process and they are not accessible at the point you are trying to reach them. Instead you must declare a string variable to your viewcontroller and set text to label on its viewDidLoad method (after the loading process has finished) class StoryViewController: UIViewController {...
ios,uitableview,swift,xcode6,iboutlet
You've probably forgot to set AnimalCell as the class for the cell in the storyboard. You'll need to select the cell and in the Utilities Sidebar, go to the Identity Inspector and fill in the Class field with AnimalCell. Command + Option + 3 will take you directly to the...
cocoa,swift,xcode6,iboutlet,nswindowcontroller
i ended up doing this in my view controller which seems to work override func viewDidLayout() { var x = self.view.window?.toolbar?.items[1].label println(x) if(self.view.window?.toolbar?.items[0].label! != "Check") { toobarediting() } println("didlay") } func toobarediting() { self.view.window?.toolbar?.insertItemWithItemIdentifier("Check", atIndex: 0) } func toolbarcheck(functiontoset: Selector) { var y = self.view.window?.toolbar?.items[0] as NSToolbarItem y.action = functiontoset...
automatic-ref-counting,iboutlet,nsviewcontroller,nsstoryboard
Apple have confirmed (via bug report) that this is a known issue and will be fixed in OS X 10.10.3.
ios,swift,weak-references,iboutlet,zbar-sdk
It looks like you didn't create a bridging header. Follow the Apple Docs to create one and then import ZBarReaderView.h in the bridging header.
You access a generic ViewController, but need to use an existing UIView. Do something like this: class Test: UIViewController { class func set_cornerRadius(yourView: UIView, radius: CGFloat) { yourView.layer.cornerRadius = radius } } That way, you pass the UIView you want to set the corner-radius....
ios,xcode,swift,viewcontroller,iboutlet
Your view controller must have a custom class file assigned to it in the identity inspector in InterfaceBuilder: Then select the assistant editor and you should be able to ctrl-drag IBOutlets to the associated swift file....
xcode,swift,initialization,iboutlet
IB automatically creates instances of all objects with IBOutlets when their xib file is loaded. So, instead of creating my own, second, instance in another file: var instance = AccountPanelController() I simply made a reference to the instance IB had already made for me: IBOutlet weak var IBInstance: AcountPanelController! Unlike...
ios,swift,iboutlet,strong-references
Imagine you have created a subclass of UIView and named it ViewA. Now you are going to create ViewA by means of XIB or storyboard. All the subviews which you are going to add directly inside the ViewA will become weak property as ViewA will own them and will manage...
Assuming you are doing this on a class that extends UIViewController, the problem is that UIViewController already has a property named title with a type of NSString. By adding an outlet for a UITextField with a name of title, you are creating a conflict with the NSString property named title....
swift,operators,automatic-ref-counting,iboutlet
Swift IBOutlet are weak by default (but others properties are strong by default). So both writing are the same. You have more details about the difference between weak and strong here According to apple documentation When you declare an outlet in Swift, you should make the type of the...
ios,swift,delegates,uitabbarcontroller,iboutlet
The problem is that you're creating a new instance of MapViewController when you set the delegate with the below line. That instance isn't made in the storyboard, so it knows nothing about your IBOutlet. delegate = MapViewController() You need to get a reference to the controller that already exists. If...
First of all get to know, what is actually ! and ? Use ? : if the value can become nil in the future, so that you test for this. Use ! : if it really shouldn't become nil in the future, but it needs to be nil initially. @IBOutlet:...
ios,objective-c,xcode,storyboard,iboutlet
Go to your view controller file where you have declared IBOutlet (.h or .m). Then you can see left side of each variable declaration there is a dark grey round image. (It is filled if you have connected that IBOutlet with Storyboard/Xib unless it is unfilled.) By clicking that image...
I am answering my own question, in case someone ever has the same problem. Issue #1 I resolved by deleteing both IBOutlets and re-adding them in the storyboard. Issued #2: I did not made a call to searchResultsTableView.reloadData(). Since the network call was async, results were received in the lambda...
IBOutlet is a marker for Xcode that gets removed by the time the preprocessing step is over. Internally, setting it up boils down to assigning a single pointer to an instance variable that "backs" the IBOutlet property. This pointer is assigned at the time the view is set up, and...
The @interface can appear in both the .h file (public properties) and the .m file (private properties). The IBOutlets should be declared in the .m file. For example, here's a sample .m file for a view controller #import "MainViewController.h" @interface MainViewController () // the following property is not visible outside...
I've had a similar problem, and I think it's partially a caching issue and partially just an Xcode6/Swift issue. The first step I found was required was to make sure that the view controller .swift file would be loaded in the Assistant Editor when choosing "automatic". With Xcode finding that...
Properties declared with @IBOutlet are always implicitly unwrapped optional variables. Apple's documentation explains it this way: When you declare an outlet in Swift, the compiler automatically converts the type to a weak implicitly unwrapped optional and assigns it an initial value of nil. In effect, the compiler replaces @IBOutlet var...
ios,iphone,storyboard,target,iboutlet
You may connect 1 object to your class per view controller. Double check that you set the classes correctly; I often accidentally autocomplete the incorrect class. Ex. TermsAndConditionsTableViewController instead of TermsAndConditionsViewController This IBOutlet is connected to three different views and works correctly for me. Click on the dot to show...
swift,uitableview,code-reuse,iboutlet,tableviewcell
This issue arises while registering the UITableViewCell class as tableView.registerClass(SwitchCell.self,forCellReuseIdentifier:"SwitchCell2") Remove that line tableView.registerClass(SwitchCell.self,forCellReuseIdentifier:"SwitchCell2") and set the cellIdentifier in storyboard..it works...
objective-c,xcode,osx,iboutlet,applescript-objc
You can use Key-Value Coding for this: -(IBAction)setImages:(id)sender { int tag = (int)[sender tag]; NSString* key = [NSString stringWithFormat:@"imageView%d", tag]; NSImageView* imageView = [self valueForKey:key]; imageView.image = myImage; } Or, roughly equivalently: -(IBAction)setImages:(id)sender { int tag = (int)[sender tag]; NSString* keyPath = [NSString stringWithFormat:@"imageView%d.image", tag]; [self setValue:myImage forKeyPath:keyPath]; } ...
ios,objective-c,cocoa-touch,iboutlet
First you have to select the View and add the custom class like this: ...
ios,xcode,iboutlet,size-classes,universal-storyboard
You can't connect an IBOutlet property with more than one object. But you can use the same tag on those labels and get to them like this: (UILabel *)[self.view viewWithTag:LABEL_TAG]; ...
ios,swift,interface-builder,iboutlet,uicontrol
Off-course you can't add IBOutlet because buttons what you added to WeekdayControl are in UIViewController, you can't add Outlet to WeekdayControl, buttons only subviews of WeekdayControl, UIViewController is boss here, and you can add outlet only to UIViewController. (Sorry for my English) Better create you buttons programatically in WeekdayControl....
ios,swift,iboutlet,uicontainerview
The controller embedded in the container view is instantiated at the same time that the controller with the container view is. You should not instantiate it yourself. You only need to get a reference to it. A controller in a container view is a child view controller of the controller...
ios,iphone,swift,uiviewcontroller,iboutlet
I've had the same problem under iOS7 on very slow devices. Just wait for your views to be rendered in viewDidLayoutSubviews then do your changes. Don't forget to do so just once though for viewDidLayoutSubviews is being called a lot. var first = false override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() if...
ios,objective-c,swift,uilabel,iboutlet
You shouldn't use a custom segue to return to your first view controller. Segues always create a new instance of a view controller (unless you use an unwind segue). In your first view controller, add this method: - (IBAction)backFromMapView:(UIStoryboardSegue *)segue { NSLog(@"and we are back"); MapViewController* mvc = (MapViewController *)segue.sourceViewController;...