Forráskód Böngészése

1.优化布局使视图在旋转过程中减少卡顿,更自然。

Pen Li 9 éve
szülő
commit
37c04ca48e

BIN
Ants Contract/AntsContract.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 12 - 8
Ants Contract/common/PageViewController.m

@@ -137,8 +137,9 @@ typedef enum {
     [self.parentViewController.view layoutIfNeeded];
 }
 
-- (void)viewDidLayoutSubviews {
-    [super viewDidLayoutSubviews];
+
+- (void)viewWillLayoutSubviews {
+    
     
     [self clearControlView];
     
@@ -166,9 +167,10 @@ typedef enum {
     
     [self initControl];
     
-    [self.view.superview layoutIfNeeded];
+    [self.view setNeedsDisplay];
     
     self.pdfScrollView.scrollEnabled = YES;
+    
 }
 
 - (void)clearControlView {
@@ -182,7 +184,7 @@ typedef enum {
 - (void)rotateView {
 
     
-    [self viewDidLayoutSubviews];
+    [self viewWillLayoutSubviews];
     
     self.orientation = self.currentAppOrientation;
     
@@ -394,11 +396,13 @@ typedef enum {
     if (self.presentedViewController) {
         [self.presentedViewController dismissViewControllerAnimated:NO completion:nil];
     }
-    for (UIView * v in self.editControlView.subviews)
-    {
-        [v removeFromSuperview ];
-    }
+    
 }
+
+- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
+    [self rotateView];// 在此重新布局使视图在旋转过程中减少卡顿,更自然。
+}
+
 -(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
 {