Post

Replies

Boosts

Views

Activity

self.edgesForExtendedLayout=UIRectEdgeNone ios18beta move UIView down
Using the UINavigationController, jump from page A(UIViewController A) to page B (UIViewController B), and page B(UIViewController B) clicks back. When page A(UIViewController A) is returned, the view of page A(UIViewController A) moves down as a whole, and the top turns black. Reproduce steps: step1: Set “self.edgesForExtendedLayout = UIRectEdgeNone;” in the method “viewDidLoad” UIViewController - (void)viewDidLoad { [super viewDidLoad]; // step1 self.edgesForExtendedLayout = UIRectEdgeNone; } step2:Set “ self.navigationController.navigationBarHidden = YES;” in the method “viewWillAppear” UIViewController - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; // step2 self.navigationController.navigationBarHidden = YES; } step3:Set “self.navigationController.navigationBarHidden = NO;” in the method “viewWillDisappear” UIViewController - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; // step3 self.navigationController.navigationBarHidden = NO; } step4:Set “[self.navigationControllerpopViewControllerAnimated:NO];” in the method “viewWillDisappear” UIViewController When page is returned - (void)click { UIViewController *vc = [[UIViewController alloc] init]; vc.view.backgroundColor = [UIColor redColor]; [self.navigationController pushViewController:vc animated:YES]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ // step4,animated NO [self.navigationController popViewControllerAnimated:NO]; }); } The test found that the UIView was normal after removing the "self.edgesForExtendedLayout=UIRectEdgeNone" setting.
0
0
266
Jun ’24
UITextView crash iOS 16.2 beta1 & beta2
The code has been working for serval years. now it crashes when running on iOS 16.2 beta1 & beta2 UITextView *text = [[UITextView alloc] init]; text.attributedText = attributedText; text.frame = CGRectZero; text.editable = NO; text.scrollEnabled = NO; text.clipsToBounds = NO; text.showsVerticalScrollIndicator = NO; text.showsHorizontalScrollIndicator = NO; text.textContainer.lineFragmentPadding = 0; text.textContainerInset = UIEdgeInsetsZero; text.contentInset = UIEdgeInsetsZero; text.tag = index; [self addSubview:text]; crash log Last Exception Backtrace: 0 CoreFoundation 0x1b9849e88 __exceptionPreprocess + 164 1 libobjc.A.dylib 0x1b2b5b8d8 objc_exception_throw + 60 2 CoreFoundation 0x1b9939c58 __CFDictionaryCreateGeneric + 0 3 UIFoundation 0x1c3c937f4 -[NSCountableTextLocation compare:] + 204 4 UIFoundation 0x1c3d0d3fc -[NSTextRange textRangeByIntersectingWithTextRange:] + 144 iPhone OS 16.2 (20C5032e).crash the system is upgraded to iPhone OS 16.2 (20C5043e) from iPhone OS 16.2 (20C5032e) ,it also crash iPhone OS 16.2 (20C5043e).crash Guess it may be caused by the upgrade from TextKit1 to TextKit2. // To ensure compatibility with older code, accessing the .layoutManager of a UITextView - or its .textContainer's .layoutManager - will cause a UITextView that's using TextKit 2 to 'fall back' to TextKit 1, and return a newly created NSLayoutManager. After this happens, .textLayoutManager will return nil - and _any TextKit 2 objects you may have cached will cease functioning_. Be careful about this if you are intending to be using TextKit 2! @property(nonatomic, readonly) NSLayoutManager *layoutManager API_AVAILABLE(ios(7.0)); then call layoutManager,'fall back' to TextKit 1, it work! can I ask the question,What is the cause of the problem? can it be fixed on the 16.2 beta3 or release version? Thank you very much!
1
0
1.3k
Nov ’22