Posts

Post not yet marked as solved
26 Replies
Subclassing worked for me as well. Here is the Swift solution: class CustomTableView: UITableView {     override func layoutSubviews() {         if (self.window == nil) {             return         }         super.layoutSubviews()     } }
Post not yet marked as solved
3 Replies
I can confirm this behavior, and I think I was able to pinpoint what exactly happens and a possible workaround.1) Like the op said, the default value is read correctly. However, it is never reflected by the slider's UI.2) The slider's UI is hardcoded to real numbers between 0.0 and 1.0. It does not calculate anything, and it reflects your default as you specified it. If your default is bigger than 1, the slider will be at maximum from the first run of the app. If your minimum was 0.5, your maximum was 2.0 and your default was 0.6, the slider will appear at 60%.3) Any user interaction with the slider will replace the default with the slider's position between 0.0 and 1.0.The workaround will therefore be:1) Translate the default values of your slider to a scale between 0.0 and 1.0. For instance, I wanted the values:min: 0.001 mindefault: 0.01max: 0.15In iOS 12 I chose 1 min, 10 default and 150 max, and multiplied them by 0.001 when reading them.In iPadOS 13.1:min: 0.0 (nothing we can do about that)max: 1.0 (nothing we can do about that)And this is not so great, because we are neither 0 nor 1 based. Therefore the formula for getting the variable would be:let yourVariable = (UserDefaults.standard.double(forKey: "yourKey") + yourMinValue/(yourMaxValue-yourMinValue)) * (yourMaxValue-yourMinValue)And you calculate your default like this:defaultForPList = (yourDesiredDefaultValue-yourMinValue) / (yourMaxValue-yourMinValue)Note that in the plist you should define the values as real, not as integer.So in my case, for a min of 0.001, max of 0.15 and default of 0.01:let myVar = (UserDefaults.standard.double(forKey: "myKey") + 0.001/(0.15-0.001)) * (0.15-0.001)myDefault = (0.01-0.001)/(0.15-0.001) = 0.06040268456Thankfully, this works for iOS 12 as well.I filed with the feedback assistant, and made reference to the original report. The number of my feed back is FB7335083.
Post marked as solved
3 Replies
Confirming the same behavior. The console complains about the URL being nil. I am surprised this has not been brought up by more people. Hopefully this will be resolved in Xcode 11.1.