我试图隐藏滚动视图,但它没有隐藏

发布于 2024-10-20 09:27:36 字数 1330 浏览 6 评论 0原文

好吧,这是一个令人尴尬的简单问题,但我就是无法让它正常工作!我有两个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风月客 2024-10-27 09:27:36

试试这个:

scrollView2.hidden = YES;  // one equals sign

双等于是在进行比较,而不是赋值,而且它基本上没有完成任何事情。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文