Reputation: 38142
Is there any harm in calling loadView explicitly?
I have to hit the server and get the data for display and this data will be changed based on some user action on this view. I am making the server call in my loadView method and passing the appropriate parameters. Now when user condition changes, I call [self loadView] with modified parameters. Do you see some issue here?
Upvotes: 5
Views: 2278
Reputation: 38142
I have made another server call, fetched the data, updated the modal and then refreshed the view. NO CALL TO loadView!!!
Upvotes: 0
Reputation: 94794
Call the UIViewController's view
method instead. That will call loadView
if necessary.
Upvotes: 5
Reputation: 100612
Bad. Because:
Set up your view to have two configurations, communicating to the user either that it is loading from the server or that it is available for input, even it's just having a spinner visible or not having a spinner visible. Create a means to switch between them. Use it to communicate with your user.
Trying to subvert intended patterns is always going to lead you down a road where, at the absolute best of times most things appear to work and you fool yourself that one more hack will resolve the final problem, and at the worst of times nothing much works any more and you've spent so long digging yourself into the whole that getting out means starting again anyway.
Upvotes: 1
Reputation: 22266
Well I think the Apple documentation says it all:
loadView Creates the view that the controller manages.
-(void)loadView You should never call this method directly.
Upvotes: 13