开发者

How do I access UIImageViews that have gone outof scope and that shares the same name as multiple others

I have a for loop that creates multiple UIImageViews that I add to self.view I do this in my custom init method.

- (id)init {
 if ( self = [super init] ) {
    for ( int i = o; i < [count]; i++ ) {    //count is a variable I am using (typicly 3)
        UIImageView *tmpImageView = [[UIImageView alloc] initWithImage[data getImage]];
        tmpImagView.tag = i;
       开发者_开发技巧 tmpImageView.frame = self.view.frame;
        [self.view addSubview:tmpImageView];
    }
}

In my on method I want to access this tmpImageView and change it's properties like transform and frame

- (void)otherMethod {
    //Play with the tmpImageView's properties
}

But the tmpImageView is out of scope. How do I access it. Without using an NSMutableArray


- (void)otherMethod {
    UIImageView* tImageView = (UIImageView*) [self.view viewWithTag: someTag];
    //Play with the tmpImageView's properties
} 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜