我试图隐藏一个scrollView,它没有隐藏

时间:2011-03-04 21:41:00

标签: iphone uiscrollview uiimageview show-hide

好的,这是一个令人尴尬的简单问题,但我无法让这个工作正常!我有两张uiscrollviews,我已经在IB的各个地方联系过了。在viewDidLoad上,我只希望第一个可见。所以我mkae两个scrollViews:

    [scrollView1 setBackgroundColor:[UIColor blackColor]];
[scrollView1 setCanCancelContentTouches:NO];
scrollView1.clipsToBounds = NO;    // default is NO, we want to restrict drawing within our scrollview
scrollView1.indicatorStyle = UIScrollViewIndicatorStyleWhite;

scrollView1.minimumZoomScale = 1;
scrollView1.maximumZoomScale = 5;
scrollView1.delegate = self;
[scrollView1 setScrollEnabled:YES];

imageView31 = [[UIImageView alloc] initWithImage:firstImage];

[scrollView1 addSubview:imageView31];
//[scrollView1 setFrame:CGRectMake(0, 0, 1024, 660)];


[scrollView2 setBackgroundColor:[UIColor blackColor]];
[scrollView2 setCanCancelContentTouches:NO];
scrollView2.clipsToBounds = NO;    // default is NO, we want to restrict drawing within our scrollview
scrollView2.indicatorStyle = UIScrollViewIndicatorStyleWhite;

scrollView2.minimumZoomScale = 1;
scrollView2.maximumZoomScale = 5;
scrollView2.delegate = self;
[scrollView2 setScrollEnabled:YES];

imageView32 = [[UIImageView alloc] initWithImage:firstImage];

[scrollView2 addSubview:imageView32];

然后为了显示第一个,我这样做:

scrollView2.hidden == YES;

但是当我加载!!!它仍然存在!

有人知道发生了什么事吗?

1 个答案:

答案 0 :(得分:5)

请改为尝试:

scrollView2.hidden = YES;  // one equals sign

双等于进行比较,而非作业,而且基本上没有完成任何事情。