General question about iPhone programming
I have a question regarding nibs and how detail views are created in professional apps. I want to make an app that loads different uitextfields for each nib that is selected from 开发者_如何学运维a table. These textfields contain some logic that is different from each. I wanted to ask if it's possible to make one nib and change the data from thatto match all these scenarios. I'm unsure how this is done and how nib management can be done by arrays. Thanks and I hope I was clear enough :)
I can only speak myself but I've moved away from nibs. When you get complex layouts that have elements disappearing and reappearing your nib/s become unmanageable. You can do a better job of keeping elements tidy and manageable in code as well as a slightly faster App (not much but its a nice bonus).
EDIT: As a very basic example just remove any details of a nib and if you class is a UIViewController subclass do this:
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(50,50,150,30);
label.text = @"Hello World";
[self.view addSubview:label];
[label release];
Very basic but hopefully this will get you on your way to developing without nibs. Note: Nibs aren't bad and if its a basic view use them but if you are having complex views you will find nibs becoming unmanageable.
I found this article on Cocoa With Love to be really interesting in regardless to performance of nibs vs code.
IB / Nibs are useful for "getting started" and quick prototyping. However like @Rudiger mentions it's useful only in simple, static layouts. Usually it's only a matter of time before you'll run into limitations and find yourself having to write real code.
精彩评论