diff --git a/jiaModuleDemo.xcodeproj/project.pbxproj b/jiaModuleDemo.xcodeproj/project.pbxproj index 16d5cce..cec5b4d 100644 --- a/jiaModuleDemo.xcodeproj/project.pbxproj +++ b/jiaModuleDemo.xcodeproj/project.pbxproj @@ -283,6 +283,7 @@ 3481C0741DACDBCC00943B14 /* JiaSearchBar_ICON@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3481C0731DACDBCC00943B14 /* JiaSearchBar_ICON@2x.png */; }; 3481C0771DACDBEA00943B14 /* JiaSearchBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 3481C0761DACDBEA00943B14 /* JiaSearchBar.m */; }; 3481C07A1DACDD4800943B14 /* JiaSearchBarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3481C0791DACDD4800943B14 /* JiaSearchBarViewController.m */; }; + 3481C07D1DACEDFF00943B14 /* JiaShareMenuView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3481C07C1DACEDFF00943B14 /* JiaShareMenuView.m */; }; 34919F741D98E7AB004B7307 /* GVUserDefaults.m in Sources */ = {isa = PBXBuildFile; fileRef = 34919F731D98E7AB004B7307 /* GVUserDefaults.m */; }; 34919F901D990F1E004B7307 /* JiaPathchHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 34919F8F1D990F1E004B7307 /* JiaPathchHelper.m */; }; 34919F931D990FFE004B7307 /* JiaPathchModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 34919F921D990FFE004B7307 /* JiaPathchModel.m */; }; @@ -886,6 +887,8 @@ 3481C0761DACDBEA00943B14 /* JiaSearchBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JiaSearchBar.m; sourceTree = ""; }; 3481C0781DACDD4800943B14 /* JiaSearchBarViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JiaSearchBarViewController.h; sourceTree = ""; }; 3481C0791DACDD4800943B14 /* JiaSearchBarViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JiaSearchBarViewController.m; sourceTree = ""; }; + 3481C07B1DACEDFF00943B14 /* JiaShareMenuView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JiaShareMenuView.h; sourceTree = ""; }; + 3481C07C1DACEDFF00943B14 /* JiaShareMenuView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JiaShareMenuView.m; sourceTree = ""; }; 34919F721D98E7AB004B7307 /* GVUserDefaults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GVUserDefaults.h; sourceTree = ""; }; 34919F731D98E7AB004B7307 /* GVUserDefaults.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GVUserDefaults.m; sourceTree = ""; }; 34919F7B1D98EAB0004B7307 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; @@ -2524,6 +2527,8 @@ 34F8825C1DAB726400C14292 /* JiaPlatformHelper.m */, 3406183D1DABDCD900AFC766 /* JiaShareTool.h */, 3406183E1DABDCD900AFC766 /* JiaShareTool.m */, + 3481C07B1DACEDFF00943B14 /* JiaShareMenuView.h */, + 3481C07C1DACEDFF00943B14 /* JiaShareMenuView.m */, 34F882561DAB610B00C14292 /* JiaShare.h */, ); path = JiaShare; @@ -2913,6 +2918,7 @@ 343EB5F11D922C2B00110CE5 /* NSNumber+RomanNumerals.m in Sources */, 343EB5EE1D922C2B00110CE5 /* NSDecimalNumber+CalculatingByString.m in Sources */, 3481C0771DACDBEA00943B14 /* JiaSearchBar.m in Sources */, + 3481C07D1DACEDFF00943B14 /* JiaShareMenuView.m in Sources */, 3468FFD51D90CA1A00A69723 /* MBProgressHUD.m in Sources */, 343EB63E1D922C2C00110CE5 /* UIDevice+Hardware.m in Sources */, 34F83CBA1D9B9EB60085A540 /* YTKNetworkAgent.m in Sources */, diff --git a/jiaModuleDemo/App/JiaApp.xcassets/Contents.json b/jiaModuleDemo/App/JiaApp.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/jiaModuleDemo/App/JiaApp.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/Contents.json b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_1.imageset/Contents.json b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_1.imageset/Contents.json new file mode 100644 index 0000000..aa4fd1c --- /dev/null +++ b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_1.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "sns_icon_1.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "sns_icon_1@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_1.imageset/sns_icon_1.png b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_1.imageset/sns_icon_1.png new file mode 100644 index 0000000..240728d Binary files /dev/null and b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_1.imageset/sns_icon_1.png differ diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_1.imageset/sns_icon_1@2x.png b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_1.imageset/sns_icon_1@2x.png new file mode 100644 index 0000000..bd459e2 Binary files /dev/null and b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_1.imageset/sns_icon_1@2x.png differ diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_2.imageset/Contents.json b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_2.imageset/Contents.json new file mode 100644 index 0000000..62c3545 --- /dev/null +++ b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_2.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "sns_icon_2.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "sns_icon_2@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_2.imageset/sns_icon_2.png b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_2.imageset/sns_icon_2.png new file mode 100644 index 0000000..0c2e9cc Binary files /dev/null and b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_2.imageset/sns_icon_2.png differ diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_2.imageset/sns_icon_2@2x.png b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_2.imageset/sns_icon_2@2x.png new file mode 100644 index 0000000..2c6fc98 Binary files /dev/null and b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_2.imageset/sns_icon_2@2x.png differ diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_3.imageset/Contents.json b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_3.imageset/Contents.json new file mode 100644 index 0000000..ce263bb --- /dev/null +++ b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_3.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "sns_icon_3.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "sns_icon_3@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_3.imageset/sns_icon_3.png b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_3.imageset/sns_icon_3.png new file mode 100644 index 0000000..54361ea Binary files /dev/null and b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_3.imageset/sns_icon_3.png differ diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_3.imageset/sns_icon_3@2x.png b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_3.imageset/sns_icon_3@2x.png new file mode 100644 index 0000000..a55a006 Binary files /dev/null and b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_3.imageset/sns_icon_3@2x.png differ diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_4.imageset/Contents.json b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_4.imageset/Contents.json new file mode 100644 index 0000000..3b3972c --- /dev/null +++ b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_4.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "sns_icon_4.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "sns_icon_4@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_4.imageset/sns_icon_4.png b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_4.imageset/sns_icon_4.png new file mode 100644 index 0000000..229d62d Binary files /dev/null and b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_4.imageset/sns_icon_4.png differ diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_4.imageset/sns_icon_4@2x.png b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_4.imageset/sns_icon_4@2x.png new file mode 100644 index 0000000..37781a3 Binary files /dev/null and b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_4.imageset/sns_icon_4@2x.png differ diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_5.imageset/Contents.json b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_5.imageset/Contents.json new file mode 100644 index 0000000..0268f10 --- /dev/null +++ b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_5.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "sns_icon_5.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "sns_icon_5@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_5.imageset/sns_icon_5.png b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_5.imageset/sns_icon_5.png new file mode 100644 index 0000000..b7f2d8a Binary files /dev/null and b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_5.imageset/sns_icon_5.png differ diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_5.imageset/sns_icon_5@2x.png b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_5.imageset/sns_icon_5@2x.png new file mode 100644 index 0000000..796932a Binary files /dev/null and b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_5.imageset/sns_icon_5@2x.png differ diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_6.imageset/Contents.json b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_6.imageset/Contents.json new file mode 100644 index 0000000..0b6506c --- /dev/null +++ b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_6.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "sns_icon_6.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "sns_icon_6@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_6.imageset/sns_icon_6.png b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_6.imageset/sns_icon_6.png new file mode 100644 index 0000000..f30ff2d Binary files /dev/null and b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_6.imageset/sns_icon_6.png differ diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_6.imageset/sns_icon_6@2x.png b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_6.imageset/sns_icon_6@2x.png new file mode 100644 index 0000000..f320514 Binary files /dev/null and b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_6.imageset/sns_icon_6@2x.png differ diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_7.imageset/Contents.json b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_7.imageset/Contents.json new file mode 100644 index 0000000..9851030 --- /dev/null +++ b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_7.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "sns_icon_7.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "sns_icon_7@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_7.imageset/sns_icon_7.png b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_7.imageset/sns_icon_7.png new file mode 100644 index 0000000..92ac7dd Binary files /dev/null and b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_7.imageset/sns_icon_7.png differ diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_7.imageset/sns_icon_7@2x.png b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_7.imageset/sns_icon_7@2x.png new file mode 100644 index 0000000..aa5d0eb Binary files /dev/null and b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_7.imageset/sns_icon_7@2x.png differ diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_8.imageset/Contents.json b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_8.imageset/Contents.json new file mode 100644 index 0000000..ef383dd --- /dev/null +++ b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_8.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "sns_icon_8.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "sns_icon_8@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_8.imageset/sns_icon_8.png b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_8.imageset/sns_icon_8.png new file mode 100644 index 0000000..c2d0584 Binary files /dev/null and b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_8.imageset/sns_icon_8.png differ diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_8.imageset/sns_icon_8@2x.png b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_8.imageset/sns_icon_8@2x.png new file mode 100644 index 0000000..4f2ac56 Binary files /dev/null and b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_8.imageset/sns_icon_8@2x.png differ diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_9.imageset/Contents.json b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_9.imageset/Contents.json new file mode 100644 index 0000000..bd4391b --- /dev/null +++ b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_9.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "sns_icon_9.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "sns_icon_9@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_9.imageset/sns_icon_9.png b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_9.imageset/sns_icon_9.png new file mode 100644 index 0000000..84d7e31 Binary files /dev/null and b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_9.imageset/sns_icon_9.png differ diff --git a/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_9.imageset/sns_icon_9@2x.png b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_9.imageset/sns_icon_9@2x.png new file mode 100644 index 0000000..60001ce Binary files /dev/null and b/jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/sns_icon_9.imageset/sns_icon_9@2x.png differ diff --git a/jiaModuleDemo/App/TestControllerGroup/JiaTestListViewController.m b/jiaModuleDemo/App/TestControllerGroup/JiaTestListViewController.m index 7f810ea..6cd34f8 100644 --- a/jiaModuleDemo/App/TestControllerGroup/JiaTestListViewController.m +++ b/jiaModuleDemo/App/TestControllerGroup/JiaTestListViewController.m @@ -12,6 +12,8 @@ #import "JiaLoginViewController.h" #import "JiaSearchBarViewController.h" +#import "JiaShareMenuView.h" + @interface JiaTestListViewController() @property (nonatomic,strong) NSArray *dataArray; @property (nonatomic,strong) UITableView *myTableView; @@ -25,7 +27,7 @@ - (void)viewDidLoad { self.navigationItem.title=@"模块功能导航"; if (!self.dataArray) { - self.dataArray=@[@"WEB分享实例",@"第三方登录",@"自定义SearchBar"]; + self.dataArray=@[@"WEB分享实例",@"第三方登录",@"弹出分享菜单",@"自定义SearchBar"]; } //初始化表格 @@ -86,12 +88,27 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath break; } case 2: + { + NSArray *contentArray = @[@{@"name":@"新浪微博",@"icon":@"sns_icon_3"}, + @{@"name":@"QQ空间 ",@"icon":@"sns_icon_5"}, + @{@"name":@"QQ",@"icon":@"sns_icon_4"}, + @{@"name":@"微信",@"icon":@"sns_icon_7"}, + @{@"name":@"朋友圈",@"icon":@"sns_icon_8"}, + @{@"name":@"微信收藏",@"icon":@"sns_icon_9"}]; + JiaShareMenuView *shareView = [[JiaShareMenuView alloc] init]; + shareView.rowNumberItem=3; + shareView.cancelButtonText=@"取消分享"; + [shareView addShareItems:self.view shareItems:contentArray selectShareItem:^(NSInteger tag, NSString *title) { + NSLog(@"%ld --- %@", tag, title); + }]; + break; + } + case 3: { JiaSearchBarViewController *vc=[[JiaSearchBarViewController alloc]init]; [self.navigationController pushViewController:vc animated:YES]; break; } - default: break; } diff --git a/jiaModuleDemo/BaseModule/JiaShare/JiaShare.h b/jiaModuleDemo/BaseModule/JiaShare/JiaShare.h index b545013..82cfb3e 100644 --- a/jiaModuleDemo/BaseModule/JiaShare/JiaShare.h +++ b/jiaModuleDemo/BaseModule/JiaShare/JiaShare.h @@ -13,5 +13,6 @@ #import "JiaShareHelper.h" #import "JiaWebShareHelper.h" #import "JiaPlatformHelper.h" +#import "JiaShareMenuView.h" #endif /* JiaShare_h */ diff --git a/jiaModuleDemo/BaseModule/JiaShare/JiaShareMenuView.h b/jiaModuleDemo/BaseModule/JiaShare/JiaShareMenuView.h new file mode 100644 index 0000000..7c4616b --- /dev/null +++ b/jiaModuleDemo/BaseModule/JiaShare/JiaShareMenuView.h @@ -0,0 +1,41 @@ +// +// JiaShareMenuView.h +// jiaModuleDemo 从底部弹出菜单视图 +// +// Created by wujunyang on 16/10/11. +// Copyright © 2016年 wujunyang. All rights reserved. +// + +#import + +typedef void (^selectItemBlock)(NSInteger tag, NSString *title); + +@interface JiaShareItemButton : UIButton + +@end + +@interface JiaShareMenuView : UIView + +//一行有几个 +@property(nonatomic)NSInteger rowNumberItem; + +//菜单文字设置 +@property(nonatomic,strong)UIFont *shareItemButtonFont; +@property(nonatomic,strong)UIColor *shareItemButtonColor; + +//底部取消相关设置 +@property(nonatomic,strong)UIColor *cancelBackgroundColor; +@property(nonatomic,copy)NSString *cancelButtonText; +@property(nonatomic,strong)UIFont *cancelButtonFont; +@property(nonatomic,strong)UIColor *cancelButtonColor; + +/** + * 弹出分享 + * + * @param superView 父视图 + * @param shareItems QQ/WeChat/Weibo + * @param selectShareItem 点击回调 + */ +- (void)addShareItems:(UIView *)superView shareItems:(NSArray *)shareItems selectShareItem:(selectItemBlock)selectShareItem; + +@end diff --git a/jiaModuleDemo/BaseModule/JiaShare/JiaShareMenuView.m b/jiaModuleDemo/BaseModule/JiaShare/JiaShareMenuView.m new file mode 100644 index 0000000..8d2e7a6 --- /dev/null +++ b/jiaModuleDemo/BaseModule/JiaShare/JiaShareMenuView.m @@ -0,0 +1,160 @@ +// +// JiaShareMenuView.m +// jiaModuleDemo +// +// Created by wujunyang on 16/10/11. +// Copyright © 2016年 wujunyang. All rights reserved. +// + +#import "JiaShareMenuView.h" + +#define kScreenWidth [[UIScreen mainScreen] bounds].size.width +#define kScreenHeight [[UIScreen mainScreen] bounds].size.height + +#define kBtnW 60 +#define kBtnH 60 +#define kMarginX 15 +#define kMarginY 15 +#define kFirst 10 +#define kTitlePrecent 0.4 +#define kImageViewWH 40 +#define RGB(r, g, b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0] + + +@interface JiaShareItemButton() +@end +@implementation JiaShareItemButton +- (id)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + self.titleLabel.textAlignment = NSTextAlignmentCenter; + self.titleLabel.font = [UIFont systemFontOfSize:10]; + [self setTitleColor:RGB(40, 40, 40) forState:UIControlStateNormal]; + self.imageView.layer.cornerRadius = kImageViewWH * 0.5; + } + return self; +} +#pragma mark 调整文字的位置和尺寸 +- (CGRect)titleRectForContentRect:(CGRect)contentRect{ + CGFloat titleW = self.frame.size.width; + CGFloat titleH = self.frame.size.height * kTitlePrecent; + CGFloat titleX = 2; + CGFloat titleY = self.frame.size.height * (1 - kTitlePrecent) + 7; + return CGRectMake(titleX, titleY, titleW, titleH); +} +#pragma mark 调整图片的位置和尺寸 +- (CGRect)imageRectForContentRect:(CGRect)contentRect{ + CGFloat imageW = kImageViewWH; + CGFloat imageH = kImageViewWH; + CGFloat imageX = (self.frame.size.width - kImageViewWH) * 0.5; + CGFloat imageY = 2; + return CGRectMake(imageX, imageY, imageW, imageH); +} +@end + + +@interface JiaShareMenuView() +@property (nonatomic, strong) NSArray *sharItems; +@property (nonatomic, strong) UIView *backgroundView; +@property (nonatomic, strong) UIButton *canleBtn; +@property (nonatomic, copy) void(^btnBlock)(NSInteger tag, NSString *title); +@end + +@implementation JiaShareMenuView + +- (void)addShareItems:(UIView *)superView shareItems:(NSArray *)shareItems selectShareItem:(selectItemBlock)selectShareItem{ + if (shareItems == nil || shareItems.count < 1) return; + self.backgroundColor = [UIColor groupTableViewBackgroundColor]; + [self addBackgroundView:superView]; + + //相关属性值 + NSInteger curRowNumberItem=self.rowNumberItem?:4; + NSString *cannelText=self.cancelButtonText?:@"取消"; + + [shareItems enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + NSString *name = obj[@"name"]; + NSString *icon = obj[@"icon"]; + JiaShareItemButton *btn = [JiaShareItemButton buttonWithType:UIButtonTypeCustom]; + btn.titleLabel.font =self.shareItemButtonFont?:[UIFont systemFontOfSize:10]; + [btn setTitleColor:self.shareItemButtonColor?:RGB(40, 40, 40) forState:UIControlStateNormal]; + btn.tag = idx; + [btn setTitle:name forState:UIControlStateNormal]; + [btn setImage:[UIImage imageNamed:icon] forState:UIControlStateNormal]; + [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside]; + + CGFloat marginX = (self.frame.size.width - curRowNumberItem * kBtnW) / (curRowNumberItem + 1); + NSInteger col = idx % curRowNumberItem; + NSInteger row = idx / curRowNumberItem; + CGFloat btnX = marginX + (marginX + kBtnW) * col; + CGFloat btnY = kFirst + (kMarginY + kBtnH) * row; + btn.frame = CGRectMake(btnX, btnY, kBtnW, kBtnH); + [self addSubview:btn]; + }]; + + //计算面板大小 + NSUInteger row = (shareItems.count - 1) / curRowNumberItem; + CGFloat height = kFirst + 100 + (row +1) * (kBtnH + kMarginY); + + //分割线 + UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, (row +1)* (kBtnH + kMarginY)+5, kScreenWidth, 0.5)]; + line.backgroundColor = RGB(180, 180, 180); + [self addSubview:line]; + + //取消 + self.canleBtn = [UIButton buttonWithType:UIButtonTypeCustom]; + self.canleBtn.frame = CGRectMake(0, CGRectGetMaxY(line.frame), self.frame.size.width, 44); + [self.canleBtn setTitle:cannelText forState:UIControlStateNormal]; + self.canleBtn.titleLabel.font =self.cancelButtonFont?:[UIFont systemFontOfSize:16]; + [self.canleBtn setBackgroundColor:self.cancelBackgroundColor?:[UIColor whiteColor]]; + [self.canleBtn setTitleColor:self.cancelButtonColor?:[UIColor grayColor] forState:UIControlStateNormal]; + [self.canleBtn addTarget:self action:@selector(cancleButtonAction) forControlEvents:UIControlEventTouchUpInside]; + [self addSubview:self.canleBtn]; + + self.btnBlock = ^(NSInteger tag, NSString *title){ + if(selectShareItem) selectShareItem(tag, title); + }; + + //增加 + [superView addSubview:self]; + + CGFloat originY = [UIScreen mainScreen].bounds.size.height; + self.frame = CGRectMake(0, originY, 0, height); + [UIView animateWithDuration:0.25 animations:^{ + CGRect sF = self.frame; + sF.origin.y = kScreenHeight - sF.size.height; + self.frame = sF; + }]; +} +- (void)setFrame:(CGRect)frame{ + frame.size.width = kScreenWidth; + if (frame.size.height <= 0) { + frame.size.height = 0; + } + frame.origin.x = 0; + [super setFrame:frame]; +} +- (void)addBackgroundView:(UIView *)superView{ + _backgroundView = [[UIView alloc] initWithFrame:superView.bounds]; + _backgroundView.backgroundColor = [UIColor blackColor]; + _backgroundView.alpha = 0.4; + + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(cancleButtonAction)]; + [_backgroundView addGestureRecognizer:tap]; + [superView addSubview:_backgroundView]; +} +- (void)cancleButtonAction{ + [_backgroundView removeFromSuperview]; + _backgroundView = nil; + [UIView animateWithDuration:0.25 animations:^{ + CGRect sf = self.frame; + sf.origin.y = kScreenHeight; + self.frame = sf; + } completion:^(BOOL finished) { + [self removeFromSuperview]; + }]; +} +- (void)btnClick:(UIButton *)sender{ + if(_btnBlock) _btnBlock(sender.tag, sender.titleLabel.text); +} +@end