Code Vs. Interface Builder Iphone

I am going through the Iphone Development Apress beginner book and am constantly having problems creating NIB files. Due to NIBS due to Google apps crashing. I do this now because I will just sell my samples for a sample and the app will work. I'll take a look at a sample sample and all my connections will be the same. I am having trouble debugging my NIBS and figuring out what exactly is wrong. So that...

1) Can you just create your interface in IB and do all the wiring in the code?

2) What's the best way to find out what's wrong with your NIBs?

3) Does anyone else have the same problems running the examples in the Apress book?

0


a source to share


5 answers


1) Can you just create your interface in IB and all the postings in the code?

You can, but this WAAAY work harder. If you don't want to use IB, then doing everything in code are the best options.

2) What's the best way to find out what happened to your NIBs?

Check each control and check all anchor points (Command-2) and class interference (Command-4).



Check interfaces, implementations for IBActions and IBOutlets, and implementations for correct loading sequences. (i.e. when using IB then initialize your view in viewDidLoad)

3) Does anyone have the same problem with examples in Apress book?

No

+3


a source


The Builder interface will indicate errors and warnings in NIB files by showing a warning icon in the lower right corner of the NIB document window. Click on this to find out what alerts are.



You can safely ignore "illegal geometry" warnings, but missing outputs, etc. can be fatal.

+2


a source


If your applications are "crashing due to NIBS", what error message do you receive when the crash occurs? There is usually a pretty big clue as to what is wrong if you look in the Xcode console and this is usually the best way to start figuring out what might be causing the crash.

+1


a source


You can build your UI entirely in code if you like. I personally prefer this and only resort to NIB files for views that have a lot of elements to place.

I recommend Erica Sadun 's iPhone Developers Cookbook for a good tutorial that shows you how to do this. I wrote a review of this here .

NIBs clearly have their place, and many developers choose to connect to them using a visual tool like Interface Builder. But some of us (like me) are more likely to do things in code where practically possible.

+1


a source


I'm pretty much a beginner just like you, but found this post which advises to strike a balance between the two and illustrate it with an example:

http://wiresareobsolete.com/wordpress/2010/03/striking-the-balance-interface-builder-vs-code/

0


a source







All Articles