0

Complete IOS newbie here...

I'm writing a calendar app and trying to recreate this display:

enter image description here

So I created a custom view, subclassing UIView. I pass this view an array of Appointment objects (my own custom objects), and for each one, I create a view and call addSubView.

First test went great.

But since I want my app to display a little bit more info for each appointment, I decided to create another custom UI class with an associated nib.

Now I have to deserialize the nib file for each appointment I want to show, and this takes 100 times longer than the previous code:

let v = NSBundle.mainBundle().loadNibNamed("SingleAppointmentView", owner: nil, options: nil)[0] as! SingleAppointmentView;

Is there a better way to do this? Can I deserialize the nib once and then duplicate it? or should I just create my SingleAppointmentView in code, and let go of the convenience of a nib file?

user884248
  • 2,134
  • 3
  • 32
  • 57
  • 1
    Possible duplicate of [loadNibName method is too slow - how to make it quicker?](http://stackoverflow.com/questions/8123311/loadnibname-method-is-too-slow-how-to-make-it-quicker). – Martin R Aug 28 '16 at 08:49
  • Thanks. For some reason, using the UINib approach only produced marginal gains for me (100 views take 0.13 seconds instead of 0.14). – user884248 Aug 28 '16 at 09:02

0 Answers0