Several ways to transfer the value of iOS pages

Source: Internet
Author: User


1. Properties
2. Methods
3. Proxy methods
4.SharedApplication
5.NSUserdefault
6. Pass through a single instance of class

Property This method is very convenient to pass the value, only need to get its pointer, if the re-declaration of a pointer, it is not the original content, not the same pointer, so you need to pass a pointer.

Xxxviewcontroller *document == = value to be passed [Self.navigationcontroller pushviewcontroller:document Animated:yes]; [Document release];


Method pass the value of this as long as the declaration to the class instance variables and methods, the current page value passed.

The agent is suitable for passing values from forward. Detailed reference.

Nsuserdefault This is a dictionary that is often used to store user names and passwords. However, it is possible to overwrite the previous content in multiple passes.

Sharedapplication equivalent to a global variable [uiapplication uisharedapplication].delegete This method has not been used

This is also quite the same as the global variable

[[UIApplication Sharedapplication] delegate];
You can write a macro in Appdelegate:

#define App_delegate        ((appdelegate *) [[uiapplication sharedapplication] DELEGATE])


You can use it back.

#import " AppDelegate.h " [App_delegate.window addsubview:xxxxxx]; Fmovieappdelegatedelegate]; [Self.navigationcontroller PushViewController:appDelegate.cinemaViewController Animated:yes];




Several ways to transfer the value of iOS pages

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.