SO I have a UITableView
which contains a UITableViewCell
and tableView.header
is set to a Parallax Header. The UITableViewCell
has certain UIView
s which are set as negative constraints from Top and are shown perfectly on iOS-12 whereas when observed on iOS-13 the UIView
s showing over Parallax Header are clipped. I have tried all possible solutions but unfortunately it still shows the same. My App is opting out of SwiftUI and still running the old code. I have even tried to change the zIndex
of the child UIView
but still the same. Here are some snapshots and some code:
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
self.PriceView.layer.zPosition = 1
self.PriceView.bringSubviewToFront(self.contentView)
self.PriceView.setNeedsDisplay()
}
This code is functional for iOS-12 but not iOS-13.
UPDATE:
Apple's changelog/documentation for iOS-13 suggests:
The UITableViewCell class’s contentView property is always laid out edge-to-edge with adjacent accessories, both on the leading and the trailing side. This streamlines the layout code so developers who want the correct default offset no longer have to align their content with the content view border or the layout margin depending on whether there is an accessory on the trailing side or not. You should now always lay out their code on the layout margins of the cell’s content view to get the default system insets. These insets will be adjusted automatically based on the accessories visible in the cell to match the system’s default spacing. (48214114)
This is a bit unclear to me and if someone can help me out here.
Here are the snapshots as to how it is showing in iOS-12 which is required and how it is showing in iOS-13 respectively:
And here observe for iOS-13:
Here is also the Constraint Layout of my UITableViewCell
's PriceView
:
I need both to be consistent on both OSes. THANK YOU SO MUCH FOR THIS HELP!
Wohoo! I finally figured it out. So before as default it was working on iOS-12 but after iOS-13 and UITableViewCell
changes as described in the question, it stopped working. Here is what I did:
ContentView
of UITableViewCell
was set to Safe Area Layout Guide
which I turned off and turned on Safe Area Relative Margins
, similarly I did the same for the child, as in the PriceView. ContentView
's and UITableViewCell
's both had their Autoresize Subviews
property turned on, I simply turned it offAnd voila! It works. Hope anyone who might have these UITableViewCell
issues, please note that now its all relative 😉