Custom views with Storyboard

Putting the widget/view in a separate .xib file works, and is appropriate especially if you might want to reference that same view from multiple View Controllers. However, sometimes you do want to see the additional view/widget within the same storyboard, and it is possible. Here’s how you do it: Select your view controller in IB … Read more

Correct way to load a Nib for a UIView subclass

MyViewClass *myViewObject = [[[NSBundle mainBundle] loadNibNamed:@”MyViewClassNib” owner:self options:nil] objectAtIndex:0] I’m using this to initialise the reusable custom views I have. Note that you can use “firstObject” at the end there, it’s a little cleaner. “firstObject” is a handy method for NSArray and NSMutableArray. Here’s a typical example, of loading a xib to use as a … Read more

How to load a xib file in a UIView

To get an object from a xib file programatically you can use: [[NSBundle mainBundle] loadNibNamed:@”MyXibName” owner:self options:nil] which returns an array of the top level objects in the xib. So, you could do something like this: UIView *rootView = [[[NSBundle mainBundle] loadNibNamed:@”MyRootView” owner:self options:nil] objectAtIndex:0]; UIView *containerView = [[[NSBundle mainBundle] loadNibNamed:@”MyContainerView” owner:self options:nil] lastObject]; [rootView … Read more

Could not insert new outlet connection [duplicate]

I got the same problem as you today… I think this is a bug of Xcode, below is the way to fix the issue: Close the project you are working on with. Delete your project’s【DerivedData】folder. (This folder may inside your project’s folder, or inside ~/Library/Developer/Xcode/DerivedData/(your project)/ ) or somewhere else that was setup by you. … Read more

What is the difference between a .xib file and a .storyboard?

Apple introduced the concept of “storyboarding” in iOS5 SDK to simplify and better manage screens in your app. You can still use the .xib way of development. Pre-storyboard, each UIViewController had an associated .xib with it. Storyboard achieves two things: .storyboard is essentially one single file for all your screens in the app and it … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)