iosobjective-cuiviewuinib

Loading nib files really fast


Trying to load a few hundred UINib consecutively and really fast (one after the other in less than 0.5sec). UINib contain UIButton and a relatively small sized image (different for each nib).

I have tried this:

UINib *nib = [UINib nibWithNibName:viewName_ bundle:[NSBundle mainBundle]];
        [nib instantiateWithOwner:self options:nil];
        mainView = [[nib instantiateWithOwner:self options:nil] objectAtIndex:0];

and this:

mainView = [[[NSBundle mainBundle] loadNibNamed:viewName_ owner:self options:nil] objectAtIndex:0];

with the last being a few milliseconds faster and CPU usage is 92% vs 97%.

Which is the best way to load these nibs even faster? Or is there a better way to do this?

thanks


Solution

  • Ok the solution was really easy to this. In case someone else comes across. Wait for Apple to fix it!

    9.1 works like a charm. Everything loads super fast as expected. Thanks for your input.