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