Reputation: 3659
I have a UITabBarController which is switching between tabs just fine. The only issue I have is that sometimes it takes up to 3 seconds to respond (call didSelectViewController).
This only occurs when I am switching between pages with quite a few elements, UIViews and UILabels and such. It is instant to respond when it doesn't have any views to add and remove.
I think that it should call didSelectViewController before doing anything else on receiving a touch, but this does not seem to be the case. Does anyone have any suggestions as to how I can speed up my app?
Thanks
Upvotes: 0
Views: 759
Reputation: 21695
I expect your app is taking a long time to render the view. I suggest stepping through the viewWillAppear:
method to see if you are running a slow query or doing something else that takes a lot of time when the view is shown. If so, you might be able to use a cache or show a placeholder page while that is happening. If the app is slow because you really do have so many UIView
s, think about using a custom-rendered view instead, or a UITableView
and only loading the sub views as they are needed.
In iPhone OS 3.0 has tabBarController:shouldSelectViewController:
which gets called after the touch, but before the tab is actually selected.
Upvotes: 2
Reputation: 22395
The time you are expiriencing could be from the new views loading, if your pre load your views or keep them in memory once you already loaded them then I think switchign between them should not take that long of time...
Upvotes: 0