Note that there are some explanatory texts on larger screens.

plurals
  1. POSlow UILabel Update
    primarykey
    data
    text
    <p>I've got a very strange issue. I'm making a grid of UIImageViews (currently 16x16) which each have a UILabel on them that can contain only one character of text.</p> <p>I've got it so when you click on it, this text changes and when you release it changes again.</p> <p>These UILabels update correctly and with the proper speed.</p> <p>Unless I'm also updating the "status" UILabel (of which there is only one) for my app.</p> <p>This UILabel is significantly larger than the others, and again, only has one instance. It is located at the top of the screen, and its size is the width of the screen and 40 pixels in height.</p> <p>Now when I try to [label setText:] this label, it performs fine and with proper speed... if I'm clicking on one of my UIImageViews near the top of the screen. However, when I go to click on one towards the bottom of the screen, it takes a noticeable difference in time.</p> <p>I've removed any iteration through lists for retrieving the UIImageViews. It calculates the point of where I've clicked into an (x, y) integer coordinate, and then selects the proper UIImageView out of an array via [[array objectAtIndex:x] objectAtIndex:y]. </p> <p>I have narrowed it down to the main "status" UILabel as causing the slow-down. If I comment out the [label setText:] for that label and replace with with a NSLog printout, everything goes at the correct speed. And once again, it goes at the correct speed for UIImageViews towards the top of the screen.</p> <p>Does anyone have any suggestions? I know I'm definitely not iterating through any sort of list here, so I'm a bit confused as to why this slowdown only occurs towards the bottom of the grid.</p> <p>Thanks for the help!</p> <p>Some code:</p> <pre><code>-(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { CGPoint touchPoint = [[touches anyObject] locationInView: imageView]; int x = 0; int y = 0; x = touchPoint.x/(screenWidth/width); y = (touchPoint.y - OFFSET)/(screenHeight/height); if ( [self outOfBoundsWithX:x Y:y] ) { if ( !isMoving &amp;&amp; lastBead != nil ) { [self releaseBead:lastBead]; } lastPoint = CGPointZero; lastBead = nil; } else { if ( !isMoving &amp;&amp; lastBead != nil ) { NSLog(@"TEST"); [self releaseBead:lastBead]; } else { Bead * b = [self getBeadAtX:x Y:y]; [self releaseBead:b]; } } } - (void) releaseBead:(Bead*)b { [b setGlyph:'c']; if (statusText == "Test") { [self setStatus:"Woohoo!"]; else { [self setStatus:"Text"]; } } - (void) setStatus:(char*)status { label.text = [NSString stringWithCString:status encoding:NSASCIIStringEncoding]; statusText = status; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload