Quote:
Originally Posted by sleaver
I'm working on an RSS reader and I want to show a transparent modal view while the feed is updating before the next view containing all the feed items.
<snip>
The problem is that the loadingView does not display until the feedDetailViewController is pushed. I know this because if I comment out the line removing the window it will display as soon as the feedDetailViewController view is pushed. The loadingView doesn't need pushing as it's not done in the example I got this from and it wouldn't show when the remove line is commented out.
I have also ran into this problem with my custom UITableViewCell, I can add/change/remove items in the cell
PHP Code:
if (selected) { }
using
PHP Code:
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
But the changes can't be seen until the next view controller is pushed on to the UINavigationController. You can imaging they pretty much disappear as soon as they are shown.
So, do you know why this may be happening? If so I would appreciate any ideas on how this can be solved!
Thanks
|
I don't completely follow your sample code, but bet I know what the issue is anyway.
In iOS (and Mac OS) UI changes don't take place until you revisit the event loop. If you add a view, change a highlight flag, or whatever, you have to return from your method and let the system trigger a draw event before you see the results on the screen.
If you do a bunch of stuff, then push a view controller, THEN return, you won't get a chance to see the changes, because you haven't returned until after you push the view controller.
If you need the UI to update, you can use a method
performSelector:withObject:afterDelay:
You might do something like this:
//set a table view cell to selected (or whatever UI change)
[self performSelector: pushNewView withObject: nil afterDelay: 0];
You would then write a function pushNewView that actually pushed the new view controller. That method would get called after the system re-visited the main event loop and handled the drawing you requested.
performSelector:withObject:afterDelay: allows the system to return to the main event loop even if the delay value is zero.