iboutlet

Interface Builder, @IBOutlet and protocols for delegate and dataSource in Swift

流过昼夜 提交于 2019-11-28 06:48:38
Can't connect delegate property of CustomView declared as @IBOutlet to ViewController in Interface Builder – simply can't establish a connection. Here's the code class CustomView: UIView { @IBOutlet var delegate: CustomViewDelegate? } @objc protocol CustomViewDelegate { ... } class ViewController: UIViewController, CustomViewDelegate { ... } @objc is used because of swift protocol, IBOutlet property cannot have non-object type , don't know why protocol CustomViewDelegate: class {} doesn't work. Anyone else came across something like that? From the Xcode release notes: Interface Builder does

All IBOutlets are nil

余生颓废 提交于 2019-11-28 04:43:11
问题 Hello I am initializing viewController using this code: var aboutUsViewController = self.storyboard?.instantiateViewControllerWithIdentifier("AboutUsViewController") as AboutUsViewController After this I move to aboutViewController . However all my IBOutlets on aboutViewController are nil ! Why is that so? I am using MMDrawer library in order to have side bar menu. var aboutUsViewController = self.storyboard?.instantiateViewControllerWithIdentifier("AboutUsViewController") as

How to set the UITableView Section title programmatically (iPhone/iPad)?

有些话、适合烂在心里 提交于 2019-11-28 03:10:40
I've created a UITableView in Interface Builder using storyboards . The UITableView is setup with static cells and a number of different sections. The issue I'm having is that I'm trying to setup my app in several different languages. To do this I need to be able to change the UITableView section titles somehow. Please can someone help me out? Ideally I'd like to approach the issue using IBOutlets however I suspect this isn't even possible in this case. Any advice and suggestions would be really appreciated. Thanks in advance. Once you have connected your UITableView delegate and datasource to

IBOutlet of another view controller is nil

允我心安 提交于 2019-11-28 01:26:01
I have a storyviewcontroller which has objects on its view. I need to change the text on the UILabel(In the storyviewcontroller) and the load the view on an array. I have connected the IBOutlet to the label in the storyviewcontroller. class StoryViewController: UIViewController { @IBOutlet weak var textLabel: UILabel! @IBOutlet weak var inspiredButton: UIButton! I have created an object of the storyviewcontroller class and am able to access its variables. However, after creating the object of the storyviewcontroller, the IBOutlet is nil. Because of this, I get an exception saying found nil

All my IBOutlet are nil in viewDidLoad

和自甴很熟 提交于 2019-11-27 23:16:14
问题 I've created a UIViewController that we can call MyViewController1 . When I call MyViewController1 , all my IBOutlet are nil in viewDidLoad (and in the rest of the code too). When I create this controller by doing MyViewController1 *vc = [[MyViewController1 alloc] init] , if I replace MyViewController1 by an other one, for example MyViewController2 , it works. So I guess the problem is really in MyViewController1 . Last thing you might want to know, is that MyViewController1 is actually a

How do I connect a IBOutlet to a UIView?

微笑、不失礼 提交于 2019-11-27 22:38:07
问题 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 : view]; At the [self.view addSubview : view]; I have to add a name for the view for it to add, so I made an IBOutlet like so: (on the first view controller's .h file) IBOutlet UIView *main; But when I try to connect the *main UIView to the view on the

(Swift) PrepareForSegue: fatal error: unexpectedly found nil while unwrapping an Optional value

邮差的信 提交于 2019-11-27 18:12:57
问题 DetailViewController: @IBOutlet var selectedBundesland: UILabel! TableViewController: override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) { if (segue.identifier == "BackToCalculator") { var vc:FirstViewController = segue.destinationViewController as FirstViewController vc.selectedBundesland.text = "Test" } IBOutlet is connected! Error: fatal error: unexpectedly found nil while unwrapping an Optional value I read multiple pages about Optionals but i didn't know the

When should I use Strong vs Weak for IBOutlets (further clarification)

浪子不回头ぞ 提交于 2019-11-27 17:38:20
问题 I thought I understood it clearly from this question --> Should IBOutlets be strong or weak under ARC? but I recently had a discussion which left me totally confused. Can someone just confirm if the following is correct? (if this is a duplicate I didn't mean to break any rules.. just need clarification as I can understand diagrams better than words..) Under ARC (MacOSx) view1 = strong MainView = weak (In WindowControllerA) MainView = strong (In ViewControllerB) view2 = strong view3 = weak (In

“Could not find any information for class named ViewController”

你离开我真会死。 提交于 2019-11-27 17:16:00
This bug has been driving me nuts since I started using Xcode (4.6.3). Whenever I try to link a Storyboard item to my code, I get the error: Could not find any information for class named ViewController. This happens with custom classes as well. I've tried methods such as: Deleting the delegate data. Removing and re-adding the classes. Restarting Xcode. Reinstalling Xcode. I can't ctrl-drag to create connections in any of my projects no matter what the class is. The same problem happens with a brand-new template application. If I type in the code manually and then ctrl-drag, I can make a

awakeFromNib, outlets and storyboards: is the documentation wrong?

萝らか妹 提交于 2019-11-27 17:14:30
问题 According to the NSObject UIKit Additions Reference, outlet variables should be set by the time awakeFromNib is called (emphasis all mine): The nib-loading infrastructure sends an awakeFromNib message to each object recreated from a nib archive, but only after all the objects in the archive have been loaded and initialized. When an object receives an awakeFromNib message, it is guaranteed to have all its outlet and action connections already established. ... Important: Because the order in