Sheehan Alam
Sheehan Alam

Reputation: 60909

Building UITableViewCell in XIB or in Code?

I have always built my UITableViewCell's in code, but was wondering if there would be any advantages to using IB? I read somewhere a while ago there might be a performance hit when using a XIB, but I am not sure if that is true or not?

Upvotes: 3

Views: 514

Answers (2)

Wolfgang Schreurs
Wolfgang Schreurs

Reputation: 11834

I used to write the whole GUI of iPhone apps in code every single time. Lately I've come to the conclusion that this wasn't smart, often I would spent a lot of time getting the GUI right (moving components a few pixels to the left or right, etc...). I would suggest you create GUIs as much as possible in Interface Builder and only write it in code if performance becomes an issue. As WTP noted, UITableViewCells can get quite a boost if implemented fully in code, especially when using the technique without subviews and drawing directly on the background view. Yet, this technique also means more time is spent on developing a GUI in code, something that's probably best saved for last.

Upvotes: 5

user142019
user142019

Reputation:

Because there are file operations and parsing, using a nib will always be a performance penalty.

I prefer to use no nibs at all, but this is my own opinion.

Upvotes: 3

Related Questions