Post

Replies

Boosts

Views

Activity

Unexpected Insertion of U+2004 (Space) When Using UITextView with Pinyin Input on iOS 18
I encountered an issue with UITextView on iOS 18 where, when typing Pinyin, extra Unicode characters such as U+2004 are inserted unexpectedly. This occurs when using a Chinese input method. Steps to Reproduce: 1. Set up a UITextView with a standard delegate implementation. 2. Use a Pinyin input method to type the character “ㄨ”. 3. Observe that after the character “ㄨ” is typed, extra spaces (U+2004) are inserted automatically between the characters. Code Example: class ViewController: UIViewController { @IBOutlet weak var textView: UITextView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } } extension ViewController: UITextViewDelegate { func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { print("shouldChangeTextIn: range \(range)") print("shouldChangeTextIn: replacementText \(text)") return true } func textViewDidChange(_ textView: UITextView) { let currentText = textView.text ?? "" let unicodeValues = currentText.unicodeScalars.map { String(format: "U+%04X", $0.value) }.joined(separator: " ") print("textViewDidChange: textView.text: \(currentText)") print("textViewDidChange: Unicode Scalars: \(unicodeValues)") } } Output: shouldChangeTextIn: range {0, 0} shouldChangeTextIn: replacementText ㄨ textViewDidChange: textView.text: ㄨ textViewDidChange: Unicode Scalars: U+3128 ------------------------ shouldChangeTextIn: range {1, 0} shouldChangeTextIn: replacementText ㄨ textViewDidChange: textView.text: ㄨ ㄨ textViewDidChange: Unicode Scalars: U+3128 U+2004 U+3128 ------------------------ shouldChangeTextIn: range {3, 0} shouldChangeTextIn: replacementText ㄨ textViewDidChange: textView.text: ㄨ ㄨ ㄨ textViewDidChange: Unicode Scalars: U+3128 U+2004 U+3128 U+2004 U+3128 This issue may affect text processing, especially in cases where precise text manipulation is required, such as calculating ranges in shouldChangeTextIn.
2
0
175
5d
UIScrollView Incorrectly Scrolls When Selecting Text in UITextView on iOS 15
I'm experiencing an issue in my iOS app where tapping to select text in a UITextView that is embedded within a UIScrollView causes the scroll view to jump to an incorrect position. This problem seems to occur only on iOS 15. Does anyone know how to fix this issue, or is there a known bug regarding this behavior on iOS 15? class ViewController: UIViewController, UITextViewDelegate, UIGestureRecognizerDelegate { @IBOutlet weak var textView: UITextView! @IBOutlet weak var scrollView: UIScrollView! override func viewDidLoad() { super.viewDidLoad() textView.isScrollEnabled = false textView.layoutManager.allowsNonContiguousLayout = false } }
2
0
398
Aug ’24
Question about Live Activities Update Mechanism with Push Notification Permissions Turned Off
I have a question regarding the Live Activities feature introduced in iOS 16.1. According to the documentation, Live Activities can be updated via push notifications. However, I am curious to know if Live Activities can still receive updates via push notifications when push notification permissions are turned off for an app. Could you please clarify whether Live Activities updates are independent of the push notification permissions setting, and if so, how the update mechanism works in this scenario? Thank you for your assistance. Best regards,
1
0
577
May ’24
iOS 17 beta6 crashed
xcode15 beta6 iphone 12 pro、iOS 17 beta6 class ViewController: UIViewController { @IBOutlet weak var subView: UIView! @IBOutlet weak var imageView: BFAnimatedImageView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. imageView.layer.setNeedsDisplay() } } class BFAnimatedImageView: UIImageView { override func display(_ layer: CALayer) { super.display(layer) } } console log *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[display.BFAnimatedImageView displayLayer:]: unrecognized selector sent to instance 0x105809b30' *** First throw call stack: (0x18d3635e0 0x1856bbc00 0x18d3f3eec 0x1902a2830 0x18d2a8554 0x18d3e9860 0x104098f08 0x104098f74 0x18e8d3470 0x18e8d98a0 0x18e8d2b90 0x18f7a62d4 0x18d2adb58 0x18d2ac34c 0x18d2aa24c 0x18d2a9e18 0x1ce9675ec 0x18f6b7400 0x18f6b6a3c 0x18f8d9f10 0x104099ad0 0x104099a48 0x104099b4c 0x1afa3fd44) libc++abi: terminating due to uncaught exception of type NSException why crashed.....
2
0
870
Aug ’23