IOS development-Stage 3-Weibo (5) (Program 2) and ios Stage 3

Source: Internet
Author: User

IOS development-Stage 3-Weibo (5) (Program 2) and ios Stage 3

 

Design Concept:

Design Code according to MVC

New ZYLoginWebView inherits from UIView

Add the webView attribute in ZYLoginWebView. h.

Create the webView Initialization Method in ZYLoginWebView and add

 

 

Set the proxy import Protocol to implement two protocol Methods

Override the layoutSubviews method to set the webView frame

Let the webView load request be managed by M to create Model class ZYSinaEngine

Add the plus sign method to the ZYSinaEngine class (convenient) authorizeReuqest to return a request

The authorizeReuqest method requires many application parameters created by Sina and the parameters are used multiple times. Therefore, the macro definition is in ZYSinaEngine.

 

 

Defined in ZYLoginWebView. h

-(Void) loadAuthorizeRequest :( NSURLRequest *) request;

Create and initialize ZYLoginWebView in TimeLineViewController and load the request

Receive code in webView proxy method

 

 

After receiving the code, you need to tell TimeLineViewController to use the Protocol.

Because ZYLoginWebView wants to transmit information to others, in ZYLoginWebView, there should be a delegate Object Property id <protocol name> delegate

Write the Protocol method in ZYLoginWebView and call the Protocol method in. m.

NSError Composition

TimeLineViewController implements the proxy method to get the code

 

 

Related Article

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.