Ui_singleton (single-pass value)

Source: Internet
Author: User

Create a new class to inherit NSObject

 #import  <foundation/foundation.h>    @interface  finxingdate : nsobject    #pragma mark-Create a singleton method  //as the difference ID of the return value (generic pointer) does not know the specific object Instancetype can dynamically identify which type of  //the naming habit, share + class name  //+ ( Sharedata *)  + (instancetype) sharefinxingdate; //through the property to host the   @property  (nonatomic , strong ) nsstring  *inputstring;  @end   
@implementation FinxingDate// static 保值作用staticnil;// 单例类使用此方法,创建单例+ (instancetype)shareFinxingDate{    // 第一次必须执行完    if (nil == date) {        date = [[FinxingDate alloc] init];    }    return date;}@end

Assign the value you want to pass to [FinxingDate shareFinxingDate].inputString the
It is possible to pass values across multiple pages.

Copyright NOTICE: This article is Outlan original article, without BO Master permission cannot reprint.

Ui_singleton (single-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.