Получить тег изображений в scrollview - PullRequest
0 голосов
/ 09 марта 2012

У меня есть прокрутка, созданная с использованием следующего кода:

NSUInteger i;
for (i = 1; i <= kNumImages; i++)
{
    imageName = [NSString stringWithFormat:image, i];
    UIImage *image = [UIImage imageNamed:imageName];
    UIImageView *imageView = [[UIImageView alloc] initWithImage:image];

    CGRect rect = imageView.frame;
    rect.size.height = kScrollObjHeight;
    rect.size.width = kScrollObjWidth;
    imageView.frame = rect;
    imageView.tag = i;  // tag our images for later use when we place them in serial fashion
    [bigScrollView addSubview:imageView];
}

Как я могу получить тег изображения в настоящее время в виде?

1 Ответ

1 голос
/ 09 марта 2012

Вы можете получить тег, получив все подпредставления bigScrollView.

 for(UIView *subview in [bigScrollView subviews])
 {
     if([subview isKindOfClass:[UIImageView class]])
     {
         NSLog("%d",[subview tag]);
     }
 }
...