Unable to connect IBOutlet from storyboard to UIView subclass
After trying some of the given solution what finally worked is by restarting the my macbook. It seems like a bug on XCode's side. Oh well.
How to link ibOutlet from subview to custom UIView Class in storyboard xcode
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
Cannot connect IBOutlet to a UIViewController (or subclass thereof)
You should do this by code. And not with IBOutlets.
First: set a storyboard ID to each of the UIViewControllers.
Second:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier :"blueViewController") as! UIViewController
And connect it to a property.
You do this for all three UIViewControllers.
Is it possible to create an @IBOutlet in a custom view?
If you want to reuse a UIView then best to create an xib of the view and a custom class of the UIView. Then change the file owner in xib class to your custom class. Then you can drag and drop IBOutlets of the components inside the view to custom class. In the storyboard you can use the custom view and change the name of the class of view to custom view. Now drag and drop the IBOutlets from the story board to UIView. You can see the tutorial video on how to do , I have made for you.
https://youtu.be/IrgH522lbfA
IBOutlet is nil, but it is connected in storyboard, Swift
The storyboard wasn't recognizing any further UI things I added to it. At run time all the references were nil. So I cleared my derived data folder and then those connections worked again.
Creating IBoutlet from UIView in custom UIView class swift
In your situation, you should connect the outlets to a view controller instead of a view.
Instead of creating a UIView
subclass, you should create a UIViewController
subclass:
class FrontViewController: UIViewController {
}
Next, select your view controller in the storyboard. In the Identity Inspector (select the tab with an ID card on the panel on the left), type "FrontViewController" (the name of your class) into the "Class" field.
Now you should be able to drag outlets to the class!
Related Topics
Facebook App Invites Notification Not Working in iOS
Uitableviewcellaccessorycheckmark and Autolayout Constraints
Perform Action by Clicking on Some Word in Uitextview or Uilabel
Will Fork() in iOS App Likely Be Rejected by Apple's Vetting Process
iOS 9 Cloudkit: Query Does Not Return Anything While Connected to Cellular Network
How to Convert Cmsamplebuffer to Data in Swift
How to Run Multiple iOS Simulators at Once
Learn About the Nsxmlparser in iOS
Uiscrollview with iOS Auto Layout Constraints: Wrong Size for Subviews
How to Display Uiview Over Keyboard in iOS
How to Find Out What View a Touch Event Ended At
Get Sms Broadcast with Text Body Without Jailbreak But Private Frameworks in iOS
Get Height of iOS Keyboard Without Displaying Keyboard
Cannot Invoke Initializer for Type 'Double' with an Argument List of Type '(String)'