IOS-7-Step Learning Agency

Source: Internet
Author: User

Agent: Also called to entrust oneself can not do things entrusted to others to do

Uialertview Uitextfield, who had previously learned, used proxies.

Reverse Value Proxy proxy block

Steps to write an agent

Someone who needs help (the person who is asking for help on behalf of the meal)

1. Declare the protocol method inside the agent (

@protocol)

2. Declaring the properties of an agreement

3. When to trigger this proxy method

4. Invoking the Proxy method through the properties of the Agreement (delegate)

A helping hand (a person who helps bring a meal)

5. Import Agreement

6. In the initialization of the agent method of the place, hang up the agent (promised to help bring rice)

7. Write the proxy method waiting to be executed

1. Affirm the proxy method (do not declare the proxy method in @interface)

@protocol nextdelegate <NSObject>

-(void) Tologinwithname: (NSString *) name;

@end

2. Declare the properties of the agent (which can be found through the properties of proxy methods) in @interface

@property (nonatomic,assign) id<nextdelegate>delegate;

The properties of the claims agent are assigned to the stack with assign

Type of Id<nextdelegate>delegate Agent < name of Agent >

@property (nonatomic,copy) NSString *titlename;

3. When to trigger this proxy method

-(void) torigether{

Trigger Proxy method After clicking Register successful

4. Call this proxy method via the properties of the Protocol (delegate)

[Self.delegate tologinwithname:@ "Gourd Doll"];

[Self.navigationcontroller Poptorootviewcontrolleranimated:yes];

}

5. Import Agreement

@interface Viewcontroller () <NextDelegate,UIActionSheetDelegate>

@end

6. Attach the Agent

Next.delegate = self;

7. Write the agent method waiting to be executed (the action of the person who buys the food)

-(void) Tologinwithname: (NSString *) name{

NSLog (@ "%@ login succeeded", name);

}

2. Wait view

Indicator =[[uiactivityindicatorview Alloc]initwithactivityindicatorstyle:uiactivityindicatorviewstylewhitelarge ];

Indicator.color = [Uicolor redcolor

];

Indicator.center = Self.view.center;

[Indicator startanimating];

[Self.view Addsubview:indicator];

/3. Pop-Up Box selection button

Uiactionsheet * Acttionsheet = [[Uiactionsheet alloc]initwithtitle:

@ "Choose??" Delegate:self cancelbuttontitle:@ "Cancel" destructivebuttontitle:@ "Caution point" otherbuttontitles:@ "no?", nil];

IOS-7-Step Learning Agency

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.