When overriding Viewwillappear and Viewwilldisappear [Super Viewwillappear] and [super Viewwilldisappear] Call locations

Source: Internet
Author: User

Reference URL: Https://stackoverflow.com/questions/3906704/when-should-i-call-super

If you rewrite the Viewwillappear and Viewwilldisappear methods while writing the code, but do not invoke [super Viewwillappear] and [Super Viewwilldisappear], use the static analysis tool (Shortcut COMMAND + SHIFT + B) problem occurs when analyzing

If the problem is shown and the Xcode gives a description of the problem:

/viewcontroller.m:29:1: The ' viewwillappear: ' instance method in Uiviewcontroller subclass ' Viewcontroller ' is missing a [ Super Viewwillappear:] Call

/viewcontroller.m:29:1: The ' viewwillappear: ' instance method in Uiviewcontroller subclass ' Viewcontroller ' is missing a [ Super Viewwillappear:] Call

If the super method is called, no problem will occur when using the static analysis tool.

So if we are going to execute other code inside these two methods, should we call Super first or call the other code we want to execute first?

Https://stackoverflow.com/questions/3906704/when-should-i-call-super

That's what StackOverflow said, as shown in the above.

You can write this later.

1- (void) Viewwillappear: (BOOL) animated{2 [Super viewwillappear:animated];3     //the code to execute is called here4     5     6 }7 8- (void) Viewdidappear: (BOOL) animated{9     //the code to execute is called hereTen [Super viewdidappear:animated]; One}

Please correct me if there is any mistake.

If you want to reprint please specify the source thank you

Overriding Viewwillappear and Viewwilldisappear [Super Viewwillappear] and [super Viewwilldisappear] Call locations

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.