Information interaction notification method in iOS pass value

Source: Internet
Author: User

1. Timers

[Nstimer SchEduledtimerwithtimeinterval: How long does it change onceTarget: Who's timer selector: @selector (method name) UserInfo: Timer information repeats: repeat]

, which represents a change every 1 seconds, to set the timer, call the following Timerac, described as empty, repeating 2. Notice[[Nsnotificationcenter Defaultcenter]postnotificationname:@ "Notificationsname "object: Notification Creator UserInfo: User Information]
 after the notification is published, to have the recipient, the recipient receives the notification, the corresponding method actionreceive notifications and remember to remove notifications when you have done so in the main function   -(ibaction) Notice: (ID) Sender {//method dragged out of xib

Uitabbarcontroller *taabar = Self.viewcontroller.Tabbarcontroller;

//Implement the interface jumpto jump to the page[Taabar setSelectedIndex:3];
Notifies the interaction of the implementation message
    [[NsnotificationcenterDefaultcenter]Postnotificationname: @ "Enternotice" object:nil];
//Receive notifications in the corresponding interface[[Nsnotificationcenter Defaultcenter]Addobserver: Selfselector: @selector (Enternotice:)name: @ "Enternotice" object:nil];
//Select which page in the interface to enter-(void)Enternotice:(Nsnotification *) Noti {

Seg.Seletedindex= 1;
}
//Implement the interface jumpto jump to the page[Self.viewController.tabBarController setselectedindex:1];

[[Nsnotificationcenter Defaultcenter] Postnotificationname:@ "Enterticket"Object:nil UserInfo:@{@ "index": @ "0"}];//userinfo: Details of the contents of the notification carry @{key:index value: where to jump}

Information interaction notification method in iOS pass value

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.