asheyla asheyla - 18 days ago 4x
iOS Question

Swift determine if you have enough cells to cover the whole screen

Is there an easy way do determine if you have enough

to cover the whole screen? Like the whole screen space reserved for the
is covered in

I know you can add up the height of each
and the height of group
and the
and any other elements in the screen and see if the sum if less than the height of the screen of the used device. But is there a more elegant and easier way to know?


You can count it by something like,

  let tableViewLastPoint = self.yourTableView.tableFooterView!.frame.origin.y + self.yourTableView.tableFooterView!.frame.size.height

then compare that if tableViewLastPoint is greater than your screen's height then you have cell that requires more height then screen, else cells are not required full screen!

In this case you should initialize your tableview's footerview with zero frame like,

  self.yourTableView.tableFooterView = UIView.init(frame: CGRectZero)