0

我有一个我编写的代码,它在按下按钮时调用 UIScrollView。问题是即使按下另一个按钮,它仍然在屏幕上。我不知道如何结束或驳回这一点。

(IBAction) onClickSize:(id)sender {

viewSizePrint.hidden = YES;
scrlView.contentSize = CGSizeMake(1500, 214);

for (int i=0; i<20; i++) {
    UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(158*i+22, 2, 154, 210)];
    imgView.tag = i+10;
    [scrlView addSubview:imgView];

    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setBackgroundImage:[UIImage imageNamed:[NSString stringWithFormat:@"layout%d_thumbnail", i+1]] forState:UIControlStateNormal];
    btn.frame = CGRectMake(158*i+30, 10, 138, 194);
    btn.tag = i;
    [btn addTarget:self action:@selector(onClickTheme:) forControlEvents:UIControlEventTouchUpInside];
    [scrlView addSubview:btn];
}

[self refreshTheme:[AppDelegate sharedAppDelegate].shrTheme];

}
4

1 回答 1

0
[scrlView removeFromSuperview];
scrlView = nil;
于 2013-03-21T02:08:11.300 回答