Post

Replies

Boosts

Views

Activity

The format of UITextField is changed after clearing the text and inputting new text.
I have a UITextField and set its text format(font/color/underline) by UITextField.attributedText. However, when I clear the text than input text again, the format is changed. It seems the behavior of attributedText is reset by system after clearing the text. Is this a bug or can we have some workaround to keep the consistent format after clearing the text? The code snippet is like below: let textField = UITextField(frame: CGRectMake(0, 0, 200, 60)) let fontColor = .red let attrText = NSMutableAttributedString(string: "normal text") let range = NSRange(location: 0, length: attrText.length) attrText.addAttribute(.font, value: UIFont.systemFont(ofSize: 14), range: range) attrText.addAttribute(.foregroundColor, value: fontColor, range: range) attrText.addAttribute(.underlineColor, value: fontColor, range: range) attrText.addAttribute(.underlineStyle, value: NSUnderlineStyle.single.rawValue, range: range) textField.attributedText = attrText
1
0
291
Dec ’23
The MkAnnotationView constructor takes more time in iOS17
As an iOS native MapKit engineer, the MkAnnotationView constructor "initWithAnnotation:reuseIdentifier:" seems to take more time in iOS 17. Just use the code snippet below to measure the time, it constructs 50,000 MKAnnotationView objects. long st = [[NSDate date] timeIntervalSince1970] * 1000; NSLog(@"create annotation view start time = %ld", st); MKAnnotationView *myAV = nil; MKPointAnnotation *anno = [[MKPointAnnotation alloc] init]; anno.coordinate = CLLocationCoordinate2DMake(64, 121); for (int i = 0; i < 50000; ++i) { myAV = [[MKAnnotationView alloc] initWithAnnotation:anno reuseIdentifier:[@"hehe" stringByAppendingString:[NSString stringWithFormat:@"%d", i]]]; } long ed = [[NSDate date] timeIntervalSince1970] * 1000; NSLog(@"create annotation view end time = %ld, interval = %ld", ed, ed - st);` In iOS17, it takes around 2.6s. In iOS16, it takes around 0.9s. This performance degradation between different iOS version(iOS SDK 16 vs. iOS SDK 17) affects our app which uses the native MKMapView. Could someone take a look at this issue or offer any workaround?
0
0
317
Nov ’23