Skip to content

Update UIImage of UIImageView fail #14

Description

@mrvandai

Running OK:

  • (void)mainThreadTimerDidFire:(MSWeakTimer *)timer {
    NSAssert([NSThread isMainThread], @"This should be called from the main thread");
    int ak = [self.label.text integerValue];
    if(ak>255)
    ak= 0;
    self.label.text = [NSString stringWithFormat:@"%d", ak + 1];
    int kaaaa = floor(ak%80);
    UI *k = [oldMatrix objectAtIndex:kaaaa];
    k.backgroundColor = [UIColor colorWithRed:ak%255/255 green:ak%255/255 blue:ak%255/255 alpha:ak/255.0f];
    }

UIImageView not change image:

  • (void)mainThreadTimerDidFire:(MSWeakTimer *)timer {
    NSAssert([NSThread isMainThread], @"This should be called from the main thread");
    int ak = [self.label.text integerValue];
    if(ak>20)
    ak= 0;
    self.label.text = [NSString stringWithFormat:@"%d", ak + 1];
    UI *k = [oldMatrix objectAtIndex:kaaaa];
    UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"balls-0-%d", kaaaa]];
    k.image = image;
    }

Note: oldMatrix: array of UIImageView

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions