diff options
author | NicoleYarroch <nicole@livio.io> | 2020-08-13 15:51:25 -0400 |
---|---|---|
committer | NicoleYarroch <nicole@livio.io> | 2020-08-13 15:51:25 -0400 |
commit | 4bf505787242baf2746b4bbd76cabbad2736930f (patch) | |
tree | d400a8f5c20b2a21290ffd783d306dd1a8345376 /Example Apps/Example Swift | |
parent | 4c8137add1825297fba4302dbafa3ce0a4edefcf (diff) | |
download | sdl_ios-4bf505787242baf2746b4bbd76cabbad2736930f.tar.gz |
Fixed images and soft button states
Signed-off-by: NicoleYarroch <nicole@livio.io>
Diffstat (limited to 'Example Apps/Example Swift')
-rw-r--r-- | Example Apps/Example Swift/ButtonManager.swift | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Example Apps/Example Swift/ButtonManager.swift b/Example Apps/Example Swift/ButtonManager.swift index a2efb3096..890a0ddb4 100644 --- a/Example Apps/Example Swift/ButtonManager.swift +++ b/Example Apps/Example Swift/ButtonManager.swift @@ -61,9 +61,9 @@ class ButtonManager: NSObject { extension ButtonManager { /// Returns a soft button that shows an alert when tapped. private var softButtonAlert: SDLSoftButtonObject { - let imageSoftButtonState = SDLSoftButtonState(stateName: AlertSoftButtonImageState, text: nil, image: UIImage(named: AlertBWIconName)?.withRenderingMode(.alwaysTemplate)) - let textSoftButtonState = SDLSoftButtonState(stateName: AlertSoftButtonTextState, text: AlertSoftButtonText, image: nil) - return SDLSoftButtonObject(name: AlertSoftButton, states: [imageSoftButtonState, textSoftButtonState], initialStateName: imageSoftButtonState.name) { [weak self] (buttonPress, buttonEvent) in + let imageAndTextState = SDLSoftButtonState(stateName: AlertSoftButtonImageAndTextState, text: AlertSoftButtonText, image: UIImage(named: AlertBWIconName)?.withRenderingMode(.alwaysTemplate)) + let textState = SDLSoftButtonState(stateName: AlertSoftButtonTextState, text: AlertSoftButtonText, image: nil) + return SDLSoftButtonObject(name: AlertSoftButton, states: [imageAndTextState, textState], initialStateName: imageAndTextState.name) { [weak self] (buttonPress, buttonEvent) in guard let self = self, buttonPress != nil else { return } if (self.isAlertAllowed) { @@ -78,7 +78,9 @@ extension ButtonManager { /// Returns a soft button that shows a subtle alert when tapped. If the subtle alert is not supported, then a regular alert is shown. private var softButtonSubtleAlert: SDLSoftButtonObject { - return SDLSoftButtonObject(name: SubtleAlertSoftButton, text: nil, artwork: SDLArtwork(image: (UIImage(named: BatteryFullBWIconName)?.withRenderingMode(.alwaysTemplate))!, persistent: false, as: .PNG)) { [weak self] (buttonPress, buttonEvent) in + let imageAndTextState = SDLSoftButtonState(stateName: SubtleAlertSoftButtonImageAndTextState, text: SubtleAlertSoftButtonText, image: UIImage(named: BatteryFullBWIconName)?.withRenderingMode(.alwaysTemplate)) + let textState = SDLSoftButtonState(stateName: SubtleAlertSoftButtonTextState, text: SubtleAlertSoftButtonText, image: nil) + return SDLSoftButtonObject(name: SubtleAlertSoftButton, states: [imageAndTextState, textState], initialStateName: imageAndTextState.name) { [weak self] (buttonPress, buttonEvent) in guard let self = self, buttonPress != nil else { return } if (self.isSubtleAlertAllowed) { @@ -121,6 +123,10 @@ extension ButtonManager { if let alertSoftButton = sdlManager.screenManager.softButtonObjectNamed(AlertSoftButton) { alertSoftButton.transitionToNextState() } + + if let subtleAlertSoftButton = sdlManager.screenManager.softButtonObjectNamed(SubtleAlertSoftButton) { + subtleAlertSoftButton.transitionToNextState() + } } } } |