2014年3月10日 星期一

取用特定的Subview實體

//我們想要指定一個View去取用
UIImageView *iv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"btn"]];
            [iv setTag:978];

//直接用viewWithTag就可以針對我們想取用的View去抓到實體
UIView *_subview = [cell.contentView viewWithTag:978];
                if( _subview )
                {
                    [_subview removeFromSuperview];
                }

沒有留言:

張貼留言