ios - UILabel does not update each time with for loop -


I am trying to revive my label in my UICollectionViewCell I want to randomly go through the array and I want to set the label randomly 10 times and then it stops on my random array from my array.

The problem is, it goes through my array (it is debug with a simple NSLog) but the label set text is not used up to the last number of my loop and then The label is set.

This is my code:

  - (zero) animate (long index); (* * Self) * cells in detail in view () * {NSINXAP * indexpath = [self-colon] indexingPathophorescel: cells]; if ([array calculation]> gt; = 3) {index = 2 * indexPath.section + {Index details of cells] set text: (index: 0 = 10; i ++) for {index = 1 * index page. Section + indexpath.ro;} [[Array ObjectTitxx: Index] ReturnerRemandApout]]; [NSThread SOFT TimeInternval: 0.10]; NSLog (@ "% i", i);}}}   

and here my returnRandomOptie is from my custom cell class:

  - (NSString *) returnRandomOptie {NSUInteger randomIndex; NSString * string; if ([ Optics count]! = 0) {randomIndex = arc4random ()% [Optis count]; String = [NSString stringWithFormat: @ "% @", [Optis ObjectOutlook: Random Indax]];} Return string;}   

So basically I want that in my conscious method to loop, always sets the text in my label. And now it does not do this just on the last loop

What am I doing?

Kind regards!

You have to asynpic sleep and have to update the labels in the main thread, instead try it: < / p>

  dispatch_async (dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^ {for (int i = 0; i & lt; = 10; i ++) {dispatch_async (dispatch_get_main_queue (), ^ {{of cells Extension Labels] Set Text: [[Array ObjectTitEXx: Index] ReturnerRandsMochoppy]];}) [NSTead SOFF FOREME INTER LAVEL: 0.10]; NSLog (@ "% i", i);}});    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -