iOS学习之iOS5.0以上使用新…
2013-10-17 13:26
393 查看
原文地址:续(及解决登录无效问题)">iOS学习之iOS5.0以上使用新浪微博开放平台OAuth 续(及解决登录无效问题)作者:龍之殇
继上篇 iOS学习之iOS5.0以上
使用新浪微博开放平台OAuth
过后,新浪微博授权弹出的网页又有调整,中间还有过瘫痪情况。如果按上篇做出来的授权页面就成这样了:
续(" />
第一:网页页面变大了,
第二:没有了取消按钮。
根据这个情况在sina weibo SDK里做了写调整
调整:增加一个关闭按钮,弹出窗口大小。
在WBAuthorizeWebView.m文件的方法:bounceOutAnimationStopped里添加按钮:
[cpp] view
plaincopy
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图片sdk里自带就有。hideAndCleanUp方法就是把窗口移除。hideAndCleanUp方法原来就有。运行效果:
续(" />
看右下角有个关闭按钮,为什么放在右下角呢,因为右上角有个注册按钮,容易被点到。一会把网页窗口最大化了就能看到了。
扩大窗口
在WBAuthorizeWebView.m文件的方法- (void)sizeToFitOrientation:(UIInterfaceOrientation)orientation 修改如下:
上面的尺寸是横屏的时候的,我修改了竖屏时的窗口的大小。
[cpp] view
plaincopy
- (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;
}
运行效果:
续(" />
这个状态差不多就可以了。
还有在调用WeiBoEngine 的Logout 登出无效的情况。修改如下:
在WBAuthorize.m文件,把startAuthorize函数修改如下:
[cpp] view
plaincopy
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:appKey, @"client_id",
@"code", @"response_type",
redirectURI, @"redirect_uri",
@"mobile", @"display",
@"true",@"forcelogin", nil];
就是在 params里添加@”true”,@”forcelogin”。
以上是使用新浪微博sdk开发遇到的问题和解决的一些方法。
修改过的项目代码:http://download.csdn.net/detail/totogo2010/4928029
继上篇 iOS学习之iOS5.0以上
使用新浪微博开放平台OAuth
过后,新浪微博授权弹出的网页又有调整,中间还有过瘫痪情况。如果按上篇做出来的授权页面就成这样了:
续(" />
第一:网页页面变大了,
第二:没有了取消按钮。
根据这个情况在sina weibo SDK里做了写调整
调整:增加一个关闭按钮,弹出窗口大小。
在WBAuthorizeWebView.m文件的方法:bounceOutAnimationStopped里添加按钮:
[cpp] view
plaincopy
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图片sdk里自带就有。hideAndCleanUp方法就是把窗口移除。hideAndCleanUp方法原来就有。运行效果:
续(" />
看右下角有个关闭按钮,为什么放在右下角呢,因为右上角有个注册按钮,容易被点到。一会把网页窗口最大化了就能看到了。
扩大窗口
在WBAuthorizeWebView.m文件的方法- (void)sizeToFitOrientation:(UIInterfaceOrientation)orientation 修改如下:
上面的尺寸是横屏的时候的,我修改了竖屏时的窗口的大小。
[cpp] view
plaincopy
- (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;
}
运行效果:
续(" />
这个状态差不多就可以了。
还有在调用WeiBoEngine 的Logout 登出无效的情况。修改如下:
在WBAuthorize.m文件,把startAuthorize函数修改如下:
[cpp] view
plaincopy
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:appKey, @"client_id",
@"code", @"response_type",
redirectURI, @"redirect_uri",
@"mobile", @"display",
@"true",@"forcelogin", nil];
就是在 params里添加@”true”,@”forcelogin”。
以上是使用新浪微博sdk开发遇到的问题和解决的一些方法。
修改过的项目代码:http://download.csdn.net/detail/totogo2010/4928029
相关文章推荐
- iOS学习之iOS5.0以上使用新浪微博开放平台OAuth 续(及解决登录无效问题)
- iOS学习之iOS5.0以上 使用新浪微博开放平台OAuth
- iOS学习之iOS5.0以上 使用新浪微博开放平台OAuth
- iOS学习之iOS5.0以上 使用新浪微博开放平台OAuth
- IOS学习之IOS5.0以上 使用新浪微博开放平台OAuth
- iOS学习之iOS5.0以上 使用新浪微博开放平台OAuth
- iOS学习之iOS5.0以上 使用新…
- iOS学习之iOS5.0以上使用新浪微博…
- iOS学习之iOS5.0以上 使用新浪微博开放平台OAuth
- iOS学习之iOS5.0以上使用新浪微博开放平台OAuth 续(及解决登录无效问题)
- ElasticSearch学习(2)--使用Kibana连接ES(5.0以上版本)
- iOS5.0以上使用新浪微博开放平台OAuth 续(及解决登录无效问题)
- iOS学习之iOS5.0以上 …
- iOS学习笔记1--在xcode6以上的版本中不使用storyboard以及部分控件使用
- iOS学习之UINavigationController详解与使用(二)页面切换和segmentedController
- 开源中国iOS客户端学习——(十四)使用EGOImageLoading异步加载图片
- iOS学习之2-使用ASIHttpRequest调用WebService
- ios学习之pickerview的使用
- iOS学习之UINavigationController详解与使用(一)添加UIBarButtonItem
- iOS学习之UINavigationController详解与使用(二)页面切换和segmentedController