开发者

UIScrollView inside a UITableView won't show/hide correctly (Xcode iPhone)

开发者 https://www.devze.com 2023-01-19 11:13 出处:网络
I\'ve used Interface Builder to drop a UIScrollView into the top of a UITableView. (To do some horizontal scrolling.)

I've used Interface Builder to drop a UIScrollView into the top of a UITableView. (To do some horizontal scrolling.)

In code, I now wish to selectively show/hide that UIScrollView. I've connected it in IB, and then execute various combinations of code... but the area never disappears.

self.scrView.hidden = TRUE;

or:

CGRect aFrame       = self.scrView.frame;
aFrame.size.height  = 0;
[self.scrView setFrame:aFrame];

or:

[self.scrView setFrame:CGRectZero];
[self.scrView setContentSize:CGSizeZero];
开发者_如何学JAVA

or even the suggested:

[self.scrView removeFromSuperview];

Any way to make that thing disappear... including the area that it used to be in?


You can remove it from its parent view like this:

[self.scrView removeFromSuperView];
0

精彩评论

暂无评论...
验证码 换一张
取 消