Menu
  • HOME
  • TAGS

IBOutlet of another view controller is nil

swift,nil,iboutlet

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 {...

Swift UITableViewCell IBOutlets not displaying in StoryBoard

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...

Use NSToolBar Outlet xcode 6 and Storyboard?

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...

NSViewController not dealloc'd when outlets are bound

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.

swift: weak cannot be applied to an outlet

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.

Accessing IBOutlet from another class

ios,class,swift,null,iboutlet

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....

IBOutlets on second view controller help on swift

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....

Instance of class does not initialize IBOutlets in class

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...

When to create an outlet of strong type?

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...

Why can not use “title” as referencing outlet of UITextField?

ios,uitextfield,iboutlet

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, two issues. 1) weak var 2) bang operator for @IBOutlet

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...

Programmatically switching tabBar causes IBOutlet to be nil

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...

IBOutlets and IBactions require ! in the end

ios,swift,xcode6,iboutlet

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:...

How to find the UI element connected to a specific 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...

ios - IBOutlet class init not called and members are nil

ios,iphone,swift,iboutlet

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...

Is creating an IBOutlet too expensive?

ios,cocoa-touch,iboutlet

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...

IBOutlet declaration place

ios,objective-c,iboutlet

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...

Swift, iboutlet and custom controls

ios,xcode,swift,iboutlet

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...

Swift Master-Detail Template App Mystery

ios,swift,iboutlet,optional

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...

IBOutlet to two viewControllers on two storyboards… is that possible

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...

Reusing a UITableViewCell's IBOutlets with two different UITableViewControllers

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 | Outlet Collection OSX

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]; } ...

The imageView can not connect to the header file for IBOulet in Objective-C

ios,objective-c,cocoa-touch,iboutlet

First you have to select the View and add the custom class like this: ...

Most efficient way to reference 2 different IBOutlets at once (where each one only exists for it's own size class)?

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]; ...

How to show subclass of UIControl in View Controller

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....

Custom container: @IBOutlets nil even though view is displaying correctly

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...

IBOutlet elements come out nil when I try to set them in viewDidLoad

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...

IBOutlet does not display its value in UI

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;...