我试图隐藏滚动视图,但它没有隐藏
好吧,这是一个令人尴尬的简单问题,但我就是无法让它正常工作!我有两个 uiscrollviews,我已经将它们连接到 IB 中的任何地方。在 viewDidLoad 上,我只希望第一个可见。所以我创建了两个滚动视图:
[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;
但是当我加载时它仍然在那里!
有人知道发生了什么事吗?
Ok this is embarrassingly simple of a question, but I just can't get this to work right! I have 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
双等于是在进行比较,而不是赋值,而且它基本上没有完成任何事情。
Try this instead:
The double-equals is doing a comparison, not an assignment, and it's basically not accomplishing anything.