Design ideas:
Design code according to MVC
New Zyloginwebview inherited from UIView
Adding the WebView property in ZYLoginWebView.h
Create an initialization webview in the Zyloginwebview initialization method and add
Set up the Proxy import Protocol to implement two Protocol methods
To override the Layoutsubviews method method, set the WebView frame
Let WebView load request request into M-tube new model class Zysinaengine
Add a plus method to the Zysinaengine class (convenient) authorizereuqest returns a request
The Authorizereuqest method implementation requires many of the parameters of the application created by Sina and the parameters are used many times so the macro is defined in the Zysinaengine
Defined in ZYLoginWebView.h
-(void) Loadauthorizerequest: (nsurlrequest *) request;
Create and initialize the Zyloginwebview in Timelineviewcontroller and then load the request
Receive code in the WebView proxy method
Need to tell Timelineviewcontroller to use protocol after receiving code
Because Zyloginwebview wanted to send messages to someone, so there should be a Delegate object property id< protocol name > Delegate in Zyloginwebview
Write the Protocol method in Zyloginwebview and invoke the Protocol method in. m
The composition of the Nserror
Timelineviewcontroller implementing proxy methods get the code.
iOS development--stage three--Weibo (4) (Program 2)