Re: iOS: TableView inside ScrollView


Steve Mills
 

On Sep 18, 2018, at 03:47:36, Gerriet M. Denkmann <g@mdenkmann.de> wrote:

iOS 11, Xcode 10

I have a view with an UIScrollView, which is bound on all 4 sides to the save area.

This ScrollView contains:
UILabel
UITableView
UILabel

The problem: if the TableView does *not* have a definite height, then Xcode complains: “The ScrollView needs y-position or height fixed”.

But the whole point of the TableView is that the number of rows can change at run time.

The effect I want is similar to Settings → Wi-Fi where unter “Choose a Network” there is a dynamically changing list of names.
And the whole page can be scrolled vertically.
That's simply a table view with static sections, and each section has a set number of rows. The Choose a Network section has variable number of rows, added programmatically. You don't need to add these things to a scroll view - the table view takes care of that.

--
Steve Mills
Drummer, Mac geek

Join cocoa@apple-dev.groups.io to automatically receive all group messages.