iOS Development-page Pass value summary

Source: Internet
Author: User

1. entrustment delegate mode; 2. Notice notification mode, 3.block mode, 4.UserDefault or file mode, 5. single-case mode; 6. By setting properties, the value between pages is achieved 1: a page jumps to page b

Method:

In the controller of the B page, write the corresponding property, in the a page to jump to the B page, the B property assignment can be

Secondviewcontroller.h@property (nonatomic) Nsinteger flag;//current system designation (0: other means of transmission; 1:block pass-through value)

In the attempt controller on page a

rootviewcontroller.m-(ibaction) Showsecondview: (ID) Sender {    Secondviewcontroller *second = [[ Secondviewcontroller alloc] initwithnibname:@ "Secondviewcontroller" bundle:nil];    Second.delegate = self;    Second.flag = 0;    [Self Presentviewcontroller:second animated:yes completion:nil];}
Scenario 2: A page jumps to page B, page b jumps back to page a

Mainstream programmes:

(1) through the way of entrusting delegate to achieve

Set up protocols and methods
Secondviewcontroller.h@protocol secondviewdelegate-(void) ShowName: (NSString *) namestring; @end

Set up the proxy (weak is used here to prevent circular references)

Secondviewcontroller.h@interface Secondviewcontroller:uiviewcontroller@property (nonatomic, weak) id< Secondviewdelegate> delegate; @property (nonatomic, copy) Ablock block; @end

Transferred from: http://www.cnblogs.com/JuneWang/p/3850859.html

iOS Development-page Pass value summary

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.