美文网首页
iOS更改ShareSDK默认的分享功能界面

iOS更改ShareSDK默认的分享功能界面

作者: Kevin追梦先生 | 来源:发表于2016-12-12 09:44 被阅读973次

ShareSDK的集成这里就不详细介绍了, 官网的都已经够详细了..

官方的默认分享样式如下:

// 创建分享图片

NSString *imageURLString = @"http://mob.com/Assets/images/logo.png?v=20150320";

NSArray* imageArray = @[imageURLString];

// 分享内容参数

NSMutableDictionary *shareParams = [NSMutableDictionary dictionary];

[shareParams SSDKSetupShareParamsByText:self.productModel.data.title

images:imageArray

url:[NSURL URLWithString:@"http://www.konvy.com"]

title:@"xxxx"

type:SSDKContentTypeAuto];

[shareParams SSDKEnableUseClientShare];

__weak typeof(self) weakSelf = self;

// 分享

[ShareSDK showShareEditor:type

otherPlatformTypes:nil

shareParams:shareParams

onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) {

switch (state) {

case SSDKResponseStateSuccess:

NSLog(@"success");

break;

case SSDKResponseStateFail:

NSLog(@"fail");

break;

default:

break;

}

}];

下面是修改样式的代码(貌似在官网我没找到这个东西, 希望下面代码对大家有点作用):

需要注意的是, 这里需要集成ShareSDKUI模块(cocoapods可以通过pod ‘ShareSDK3/ShareSDKUI‘集成..)

然后在需要修改分享视图样式的地方导入, 代码贴上..

#import#import#import.....

// 创建分享图片

NSString *imageURLString = @"http://mob.com/Assets/images/logo.png?v=20150320";

NSArray* imageArray = @[imageURLString];

// 分享内容参数

NSMutableDictionary *shareParams = [NSMutableDictionary dictionary];

[shareParams SSDKSetupShareParamsByText:self.productModel.data.title

images:imageArray

url:[NSURL URLWithString:@"http://www.xxxx.com"]

title:@"xxxx"

type:SSDKContentTypeAuto];

[shareParams SSDKEnableUseClientShare];

// 初始化编辑界面

[SSUIEditorViewStyle setiPhoneNavigationBarBackgroundColor:RPNavBarColor];

[SSUIEditorViewStyle setTitleColor:[UIColor whiteColor]];

[SSUIEditorViewStyle setCancelButtonLabelColor:[UIColor whiteColor]];

[SSUIEditorViewStyle setShareButtonLabelColor:[UIColor whiteColor]];

[SSUIEditorViewStyle setTitle:@"Share"];

[SSUIEditorViewStyle setCancelButtonLabel:RPLocaolizedStringForKey(@"Cancel_Title")];

[SSUIEditorViewStyle setShareButtonLabel:RPLocaolizedStringForKey(@"Sure_Title")];

// 分享

[ShareSDK showShareEditor:type

otherPlatformTypes:nil

shareParams:shareParams

onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) {

switch (state) {

case SSDKResponseStateSuccess:

NSLog(@"xxxx");

break;

case SSDKResponseStateFail:

NSLog(@"xxxx");

break;

default:

break;

}

}];

另外这里有个比较费解的问题:

如果你使用了下面类似修改控件全局样式的代码..可能会导致上面部分代码失效, 我问了他们的技术人员, 他们一味的说不知道...orz..

[[UITextField appearance] setTintColor:[UIColor redColor]];

[[UITextView appearance] setTintColor:[UIColor redColor]];

下面是修改后的出现的问题..

你会发现左右两个item的颜色还是没有改变..

注释了上面所说的两行代码后, 一切就正常了...

另外SSUIEditorViewStyle这个类里面还有其他一些接口可以修改这个界面的样式, 例如修改按钮背景图片啊, 文本内容的北京颜色啊等等...有兴趣的, 可以去看看...#import#import@interface SSUIEditorViewStyle : NSObject

/**

*  设置导航栏背景

*

*  @param image 背景图片

*/

+ (void)setiPhoneNavigationBarBackgroundImage:(UIImage *)image;

/**

*  设置iPhone导航栏颜色

*

*  @param color 背景颜色

*/

+ (void)setiPhoneNavigationBarBackgroundColor:(UIColor *)color;

/**

*  设置iPad导航栏颜色

*

*  @param color 背景颜色

*/

+ (void)setiPadNavigationBarBackgroundColor:(UIColor *)color;

/**

*  设置编辑界面背景颜色

*

*  @param color 背景颜色

*/

+ (void)setContentViewBackgroundColor:(UIColor *)color;

/**

*  设置标题

*

*  @param title 标题

*/

+ (void)setTitle:(NSString *)title;

/**

*  设置标题文本颜色

*

*  @param color 颜色

*/

+ (void)setTitleColor:(UIColor *)color;

/**

*  设置取消按钮标签

*

*  @param label 取消按钮标签

*/

+ (void)setCancelButtonLabel:(NSString *)label;

/**

*  设置取消按钮标签文本颜色

*

*  @param color 颜色

*/

+ (void)setCancelButtonLabelColor:(UIColor *)color;

/**

*  设置取消按钮背景

*

*  @param image 图片

*/

+ (void)setCancelButtonImage:(UIImage *)image;

/**

*  设置分享按钮标签

*

*  @param label 取消按钮标签

*/

+ (void)setShareButtonLabel:(NSString *)label;

/**

*  设置分享按钮标签文本颜色

*

*  @param color 颜色

*/

+ (void)setShareButtonLabelColor:(UIColor *)color;

/**

*  设置分享按钮背景

*

*  @param image 图片

*/

+ (void)setShareButtonImage:(UIImage *)image;

/**

*  设置支持的页面方向(单独分享编辑页面)

*/

+ (void)setSupportedInterfaceOrientation:(UIInterfaceOrientationMask)toInterfaceOrientation;

/**

*  设置分享编辑页面状态栏风格

*/

+ (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle;

@end

相关文章

  • iOS更改ShareSDK默认的分享功能界面

    ShareSDK的集成这里就不详细介绍了, 官网的都已经够详细了.. 官方的默认分享样式如下: // 创建分享图片...

  • shareSDK更改其默认分享窗口

    如果应用中使用shareSDK来实现应用中的分享的功能,但是我们并没有用到那么多分享按钮,只用到了其中的几个分享按...

  • ShareSDK

    1、ShareSDK2、iOS 集成 ShareSDK 分享

  • iOS 快速实现分享文件

    在App经常用到分享或被分享功能, 有的用shareSDK这样第三方功能.优点是界面精美,功能也能做得很复杂. 但...

  • 常用软件

    omnifocus 知识管理软件 ShareSDK 功能强大、简单易用的iOS app开发必备社会化分享类库:Sh...

  • 分享问题实现汇总

    在iOS 或者安卓平台上实现社会化分享功能,一般就是通过第三方的SDK进行分享服务,如友盟分享,ShareSDK分...

  • iOS--利用shareSDK实现分享功能

    比较常见的就是QQ、微信及新浪微博的分享。第一步:集成shareSDK,我使用的是CocoaPods,导入所需三方...

  • iOS--利用shareSDK实现分享功能

    比较常见的就是QQ、微信及新浪微博的分享。 第一步: 集成shareSDK,我使用的是CocoaPods,导入所需...

  • iOS 分享-ShareSDK

    关于iOS的分享太常用也太多第三方,其中ShareSDK在使用上很方便,UI可自定义,完美!大致总结下集成思路,以...

  • ShareSDK分享到指定平台攻略

    本文介绍的是调用ShareSDK的内置方法实现分享到指定平台的功能,想了解ShareSDK的集成以及如何实现快捷分...

网友评论

      本文标题:iOS更改ShareSDK默认的分享功能界面

      本文链接:https://www.haomeiwen.com/subject/ipkmmttx.html