samedi 1 novembre 2014

setNeedsDisplay not working after adding subviews


Vote count:

0




I added about 500 views to my viewController.view. This action took about 5 seconds on target. Now I want the screen to refresh after each subview I'm adding, so the user will see them appears one by one on screen.


I tried this in my viewController:



-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
for(int i=0; i<500; i++)
{
//...Create aView
[self.view addsubview:aView];
[self.view setNeedsDisplay];
}
}


I run it and nothing happened for 5 seconds then all views appeared at once. I made sure that [self.view setNeedsDisplay] called from the main thread context.


Any idea how to make those subviews appear one by one?



asked 49 secs ago

Yony

176






setNeedsDisplay not working after adding subviews

Aucun commentaire:

Enregistrer un commentaire