iPad Adjustments not work
furiosFast opened this issue · 5 comments
furiosFast commented
WhatsNewKit Environment
- WhatsNewKit version: 1.3.7
- Xcode version: 12.0.1
- Swift version: 5.0
- macOS version running Xcode: 10.15.7
- Dependency manager (SPM, Carthage, CocoaPods, Manually): SPM
What did you do?
I've added this code for ipad adjustments:
configuration.padAdjustment = { configuration in
configuration.titleView.insets.top = 25.0
configuration.detailButton = nil
configuration.itemsView.insets.top = -20.0
configuration.itemsView.insets.left = 5.0
configuration.itemsView.insets.right = 7.0
configuration.itemsView.insets.bottom = 5.0
configuration.completionButton.insets.bottom = 17.0
WhatsNewViewController.Configuration.defaultPadAdjustment(&configuration)
}
but it doesn't works. For example the detail button is still visible.
SvenTiigi commented
Hi @furiosFast,
Due to a recent bug report (#45) the padAdjustment
closure has been refactored to be only used to update the layout insets.
Therefore changing the detailButton
to nil will have no effect inside the padAdjustment
closure.
If you wish to hide the detailButton
on an iPad you could update your WhatsNewKit configuration to something like this:
var configuration = WhatsNewViewController.Configuration()
configuration.detailButton = {
if UIDevice.current.userInterfaceIdiom == .pad {
return nil
} else {
return WhatsNewViewController.DetailButton(title: ..., action: ...)
}
}()
SvenTiigi commented
But I will try to fix this misleading behavior within the next release of WhatsNewKit ✌️
furiosFast commented
ok, thank you!!
furiosFast commented
hi,
even moving the lines of code however the customization for ipad does not work
configuration.padAdjustment = { configuration in
WhatsNewViewController.Configuration.defaultPadAdjustment(&configuration)
configuration.detailButton = nil
configuration.itemsView.insets.top = -20.0
configuration.itemsView.insets.left = 5.0
configuration.itemsView.insets.right = 7.0
configuration.itemsView.insets.bottom = 5.0
}