views:

33

answers:

1

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];

or even the suggested:

[self.scrView removeFromSuperview];

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

A: 

You can remove it from its parent view like this:

[self.scrView removeFromSuperView];
Ben
Many tries (including that one) seem to make the "object" disappear... but the huge blank area stays there. What is that... and how do I make it go away?
Patricia
Was the scroll view in the same super view as the table view? Or did it have its own view controller. The big white space sounds like there is a view or view controller with nothing else in it.
Ben
I'll have to look at the code... but I think the layout is: A scrollView containing some images. The scrollView is inside the top of a tableView... and that is inside the mainView. I need to make the scrollView (and its contained images) disappear. And NOT still leave behind the area where it used to be.
Patricia