I'm trying to hide a scrollView, and it isn't hiding
Ok this is embarrassingly simple of a question, but I just can't get this to work right! I have 开发者_JAVA百科two uiscrollviews that I have hooked up everywhere in IB. On viewDidLoad, I want only the first one to be visible. So I mkae the two 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];
and then in order to just show the first one, I do this:
scrollView2.hidden == YES;
But its still there when I load!!!
Anybody know whats going on?
Try this instead:
scrollView2.hidden = YES; // one equals sign
The double-equals is doing a comparison, not an assignment, and it's basically not accomplishing anything.
精彩评论