The problem of animation lag of navigation controller in Pushviewcontroller

Source: Internet
Author: User
Tags transparent color

Yesterday when debugging the navigation controller found in the push when the animation has a lag phenomenon, the code of the problem is as follows:

1 -(void) TableView: (UITableView *) TableView Didselectrowatindexpath: (Nsindexpath *) Indexpath {2     uiviewcontroller* newcontroller = [[Uiviewcontroller alloc] init]; 3     @" the new controller " ; 4     [Self.navigationcontroller pushviewcontroller:newcontroller animated:yes]; 5 }

At first thought is the computer performance problem, did not in the tube it, this morning again debugging time still have this problem, because this switch after the controller is Uitableviewcontroller, re-run after found that the lag phenomenon, code as follows:

1 -(void) TableView: (UITableView *) TableView Didselectrowatindexpath: (Nsindexpath *) Indexpath {2     uitableviewcontroller* newcontroller = [[Uitableviewcontroller alloc] init]; 3     @" the new controller " ; 4     [Self.navigationcontroller pushviewcontroller:newcontroller animated:yes]; 5 }

Then you are interested in this question, why switch to Uiviewcontroller when there is a lag problem? Compare the differences between Uitableviewcontroller and Uiviewcontroller, Uitableviewcontroller view is a list, the background color defaults to white, The Uiviewcontroller view is blank and the background appears black. There are two reasons why a black background appears:

1, the background color is black.

2, the alpha value of Uicolor is 0.

Does the Uiviewcontroller view default to black? First to verify.

1- (void) TableView: (UITableView *) TableView Didselectrowatindexpath: (Nsindexpath *) Indexpath {2uiviewcontroller* Newcontroller =[[Uiviewcontroller alloc] init];3uicolor* color =NewController.view.backgroundColor;4NSLog (@"Color:%@", color);5Newcontroller.title =@"the new controller";6 [Self.navigationcontroller Pushviewcontroller:newcontroller animated:yes];7}

The result of the control bar output is:

£ º17.007 weibo[5110:607] Color: (null)

The color property of the Uiviewcontroller view is empty, and it is clear that the background is black because the color is transparent.

The validation results for Uitableviewcontroller are as follows:

1- (void) TableView: (UITableView *) TableView Didselectrowatindexpath: (Nsindexpath *) Indexpath {2uitableviewcontroller* Newcontroller =[[Uitableviewcontroller alloc] init];3uicolor* color =NewController.view.backgroundColor;4NSLog (@"Color:%@", color);5Newcontroller.title =@"the new controller";6 [Self.navigationcontroller Pushviewcontroller:newcontroller animated:yes];7}

Output Result:

£ º:12.555 weibo[5128:607 1 1 1 1

So, the culprit that causes the lag is that the default color for Uiviewcontroller view is empty, and the background color is transparent. This is not the lag, but because the transparent color overlap after the visual problem, set a background color can be.

The problem of animation lag of navigation controller in Pushviewcontroller

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.