Following the previous iOS study, I used the Sina Weibo Open Platform OAuth above iOS5.0.
After that, the pop-up page of Sina Weibo authorization has been adjusted, and there is still paralysis in the middle. If the authorization page is as follows:
First, the webpage becomes larger,
Second, the cancel button is unavailable.
According to this situation, the write adjustment is made in the sina weibo SDK.
Adjust: Add a close button to display the window size.
In the WBAuthorizeWebView. m file method: bounceOutAnimationStopped, add the button:
UIButton *closeButton = [UIButton buttonWithType:UIButtonTypeCustom]; [closeButton setFrame:CGRectMake(280, 430, 60, 60)]; [closeButton setImageEdgeInsets:UIEdgeInsetsMake(3, 0, 0, 0)]; [closeButton setImage:[UIImage imageNamed:@"close"] forState:UIControlStateNormal]; [closeButton addTarget:self action:@selector(hideAndCleanUp) forControlEvents:UIControlEventTouchUpInside]; [self addSubview:closeButton];
Close.png is included in the image sdk. The hideAndCleanUp method is to remove the window. The hideAndCleanUp method was originally available. Running effect:
There is a close button in the lower right corner. Why is it placed in the lower right corner? Because there is a Registration button in the upper right corner, it is easy to be clicked. The page window will be maximized in a moment.
Expand window
In the WBAuthorizeWebView. m file method-(void) sizeToFitOrientation :( UIInterfaceOrientation) orientation modification is as follows:
The size above is the size of the landscape screen, And I modified the size of the window when the landscape screen is portrait.
- (void)sizeToFitOrientation:(UIInterfaceOrientation)orientation{ [self setTransform:CGAffineTransformIdentity]; if (UIInterfaceOrientationIsLandscape(orientation)) { [self setFrame:CGRectMake(0, 0, 480, 320)]; [panelView setFrame:CGRectMake(10, 30, 460, 280)]; [containerView setFrame:CGRectMake(10, 10, 440, 260)]; [webView setFrame:CGRectMake(0, 0, 440, 260)]; [indicatorView setCenter:CGPointMake(240, 160)]; } else { [self setFrame:CGRectMake(0, 5, 320, 470)]; [panelView setFrame:CGRectMake(0, 5, 320, 470)]; [containerView setFrame:CGRectMake(0, 5, 320, 460)]; [webView setFrame:CGRectMake(0, 0, 320, 460)]; [indicatorView setCenter:CGPointMake(160, 240)]; } [self setCenter:CGPointMake(160, 240)]; [self setTransform:[self transformForOrientation:orientation]]; previousOrientation = orientation;}
Running effect:
This status is almost enough.
In addition, when WeiBoEngine is called, Logout is invalid. Modify as follows:
In the WBAuthorize. m file, modify the startAuthorize function as follows:
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:appKey, @"client_id", @"code", @"response_type", redirectURI, @"redirect_uri", @"mobile", @"display", @"true",@"forcelogin", nil];
Add @ "true", @ "forcelogin" to params ".
The above are the problems encountered during the development using Sina Weibo sdk and some solutions.
Modified project code: http://download.csdn.net/detail/totogo2010/4928029
Rong Fangzhi (http://blog.csdn.net/totogo2010)
This article follows the "signature-non-commercial use-consistency" creation public agreement