Post

Replies

Boosts

Views

Activity

UIApplication.willEnterForegroundNotification not fired when Notification Center puts app in background
Using addObserver func of NotificationCenter.default, subscribing to UIApplication.willEnterForegroundNotification does not work when the backgrounding is triggered from Notification Center (swipe down from top when app is active to get Notification Center).  It also seems that UIApplication.willResignActiveNotification is called twice, based on Print() logs, when Notification Center triggers the backgrounding. If you background the app via lock screen or manual swipe, or switch to another app, the UIApplication.willEnterForegroundNotification does get called, so it seems to be specific to Notification Center. UIApplication.willResignActiveNotification does fire correctly but then resuming the app never calls the appMovedToForeground func below: notificationCenter.addObserver(self, selector: #selector(appMovedToForeground), name: UIApplication.willEnterForegroundNotification,object: nil) occurs on: iOS 14.4.2, iPhone 11 & iOS 14.6, SE(2)
3
0
6.5k
Nov ’23
Attributed text, dynamic type and localization
I'm using nib files not Swift UI, and trying to get attributed text in a TextView to be localized as well as scale for accessibility - Dynamic Type specifically for larger fonts set in Settings -> Accessibility. I haven't found anything in the Apple documentation, but I'm assuming attributed text is not supported in localization or accessibility. Does SwiftUI address this somehow? The "scaling fonts automatically" docs from Apple only mention using plain text in IB. Has anyone found a workaround, fix or an elegant custom solution to handle this? 3rd party OSS framework?? My first thought is to build the attributable text programmatically, using localized strings, then scale up the font size programmatically based on PreferredContentSizeCategory from the traitCollectionDidChange() notification. TIA.
1
0
1.2k
Feb ’21
Button title and accessibility for fonts
Currently working on a medical at home testing app that has to comply with certain FDA guidelines for accessibility. Mainly, larger font sizes. I understand how Dynamic Type works and that seems to be working fine so far - however, when I add a UIButton to my nib and set its Title font to style "Title 3" (for example, so that it scales with System settings), the font scales up and becomes invisible because the button itself is not scaling. I end up with an ellipse for the button Title. Also, if the button did scale it would really impact the UI in terms of the design that I am coding to. Is there any best practice or guide for how to handle this? Should I just ignore button accessibility? Any tips or advice is appreciated.
2
0
2.3k
Jan ’21