ipatch
ipatch

Reputation: 4043

IBDesignable not displaying programmatic UI elements

I created a custom ViewController class, ViewControllerRootHomeCenter which is inheriting from UIViewController, and checked the box to create a accompanying XIB file. I set the File's Owner Custom Class attribute to ViewControllerRootHomeCenter. I then created a couple of UI elements in the viewDidLoad method to see if they are loading on the device, and the simulator, which they are in fact displaying on the screen. Then in the ViewControllerRootHomeCenter.h file I set IB_DESIGNABLE above the @interface ViewControllerRootHomeCenter statement. However the XIB is displaying a white screen with no UI elements in it.

empty XIB

Upvotes: 0

Views: 448

Answers (2)

Kusal Shrestha
Kusal Shrestha

Reputation: 1673

Try this -> Paste the drawing UI elements code in (void)prepareForInterfaceBuilder{ } method (self calling method for Live rendering purpose)

Upvotes: 3

Eduardo Urso
Eduardo Urso

Reputation: 296

You also need to set the properties to be IBInspectable then they will appear in the XIB File as you want.

Code

XIB

Take a look at this link to have more examples and see if something can help you up to find a solution to your case.

Upvotes: 2

Related Questions