Storyboard changes not updating in simulator/iphone
Xcode 5 changed the control over constraints. This will often lead to mistakes in the beginning. Use the Resolve Auto Layout Issues button to fix your mistakes.
Go to storyboard and look for the menu bar to find the Resolve Auto Layout Issues button.
There you can update constraints, add missing constraints, reset to suggested constraints, or clear all constraints.
Xcode storyboard changes not showing on device or simulator
This solution had worked for me:
Just delete that storyboard in which changes are not reflecting and take new storyboard instead it will start reflecting changes.
IBInspectable not updating in storyboard but works on simulator
Firstly, you need @IBDesignable
directive to render the updates in Storyboard whereas @IBInspectable
is only to access the property directly in the Storyboard.
Secondly, you have extended the UIView
class to show the inspectable properties in the Storyboard but without @IBDesignable
.
Now you would think adding @IBDesignable
would solve your problem but sadly you can't apply @IBDesignable
on an extension like so:
@IBDesignable //won't work on an extension
extension UIView {
//...
}
You can only apply the @IBDesignable
directive on a class you have access to, like so:
@IBDesignable
class MyPrettyDesignableView: UIView {
//...
}
Solution:
Bottomline is that you should subclass UIView
and apply the @IBDesignable
directive on this class.
Basically, your only option is:
@IBDesignable
class MyPrettyDesignableView: UIView {
@IBInspectable var cornerRadius: CGFloat = 0 {
didSet {
self.layer.cornerRadius = cornerRadius
self.layer.masksToBounds = true
}
}
@IBInspectable var borderWidth: CGFloat = 0 {
didSet {
self.layer.borderWidth = borderWidth
}
}
@IBInspectable var borderColor: UIColor = #colorLiteral(red: 0, green: 0, blue: 0, alpha: 1) {
didSet {
self.layer.borderColor = borderColor.cgColor
}
}
}
Then in the storyboard, go to the view that you want designable in storyboard and change it's custom class to MyPrettyDesignableView
.
Change it's custom class to your
IBDesignable
subclass:Set the
IBInspectable
properties:
App looks different in Main.storyboard than in simulator
You need to set Constraints.
The easiest way to do it is clicking the triangle and then "Add Missing Constraints" or "Reset to Suggested Constraints" (All Views in XYZ)
It takes a bunch of time to really understand how constraints and auto layout is working. And Xcode helped me a lot with the suggested constraints...
Here is a good tutorial for the start:
http://www.raywenderlich.com/115440/auto-layout-tutorial-in-ios-9-part-1-getting-started-2
Related Topics
Pass Uicollectionview Touch Event to Its Parent Uitableviewcell
Autolayout: Origin and Size Should Change According to Width and Height Factor
Understanding Model-View-Controller
Uiwebview Not Go to Didfailloadwitherror When Weblink Not Found
None of Your Accounts Are a Member, Code Signing Errors After Upgrading to Xcode 8
Undefined Symbols for Architecture Armv7 for Cocoapods Libraries
Swift - Add Gesture Recognizer to Object in Table Cell
Game Center Login Dialog Not Shown Again After Cancelling It for the First Time (Ios7)
How to Properly Send an Image to Cloudkit as Ckasset
Uilabel, Uifont and Utf-8 Triangle
Uploading Image with iOS App to Server File Size Is Too Large
Removing Lagging Latency in Drawing Uibezierpath Smooth Lines in Swift
App Running on iPad While Its Iphone-Only
Convert Arabic String to English Number in Swift
Xcode:How to Set App to Be iPhone Only
Making Uitableview with Embedded Uicollectionview Using Uitableviewautomaticdimension