Skip to content

Commit

Permalink
封装关于分享菜单的弹出视图 JiaShareMenuView
Browse files Browse the repository at this point in the history
  • Loading branch information
wujunyang committed Oct 12, 2016
1 parent 648efa9 commit ed9f568
Show file tree
Hide file tree
Showing 34 changed files with 437 additions and 2 deletions.
6 changes: 6 additions & 0 deletions jiaModuleDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -886,6 +887,8 @@
3481C0761DACDBEA00943B14 /* JiaSearchBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JiaSearchBar.m; sourceTree = "<group>"; };
3481C0781DACDD4800943B14 /* JiaSearchBarViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JiaSearchBarViewController.h; sourceTree = "<group>"; };
3481C0791DACDD4800943B14 /* JiaSearchBarViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JiaSearchBarViewController.m; sourceTree = "<group>"; };
3481C07B1DACEDFF00943B14 /* JiaShareMenuView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JiaShareMenuView.h; sourceTree = "<group>"; };
3481C07C1DACEDFF00943B14 /* JiaShareMenuView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JiaShareMenuView.m; sourceTree = "<group>"; };
34919F721D98E7AB004B7307 /* GVUserDefaults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GVUserDefaults.h; sourceTree = "<group>"; };
34919F731D98E7AB004B7307 /* GVUserDefaults.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GVUserDefaults.m; sourceTree = "<group>"; };
34919F7B1D98EAB0004B7307 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -2524,6 +2527,8 @@
34F8825C1DAB726400C14292 /* JiaPlatformHelper.m */,
3406183D1DABDCD900AFC766 /* JiaShareTool.h */,
3406183E1DABDCD900AFC766 /* JiaShareTool.m */,
3481C07B1DACEDFF00943B14 /* JiaShareMenuView.h */,
3481C07C1DACEDFF00943B14 /* JiaShareMenuView.m */,
34F882561DAB610B00C14292 /* JiaShare.h */,
);
path = JiaShare;
Expand Down Expand Up @@ -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 */,
Expand Down
6 changes: 6 additions & 0 deletions jiaModuleDemo/App/JiaApp.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
6 changes: 6 additions & 0 deletions jiaModuleDemo/App/JiaApp.xcassets/ShareIcon/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -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"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -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"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -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"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -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"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -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"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -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"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -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"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -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"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -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"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 19 additions & 2 deletions jiaModuleDemo/App/TestControllerGroup/JiaTestListViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#import "JiaLoginViewController.h"
#import "JiaSearchBarViewController.h"

#import "JiaShareMenuView.h"

@interface JiaTestListViewController()<UITableViewDataSource, UITableViewDelegate>
@property (nonatomic,strong) NSArray *dataArray;
@property (nonatomic,strong) UITableView *myTableView;
Expand All @@ -25,7 +27,7 @@ - (void)viewDidLoad {
self.navigationItem.title=@"模块功能导航";

if (!self.dataArray) {
self.dataArray=@[@"WEB分享实例",@"第三方登录",@"自定义SearchBar"];
self.dataArray=@[@"WEB分享实例",@"第三方登录",@"弹出分享菜单",@"自定义SearchBar"];
}

//初始化表格
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions jiaModuleDemo/BaseModule/JiaShare/JiaShare.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
#import "JiaShareHelper.h"
#import "JiaWebShareHelper.h"
#import "JiaPlatformHelper.h"
#import "JiaShareMenuView.h"

#endif /* JiaShare_h */
41 changes: 41 additions & 0 deletions jiaModuleDemo/BaseModule/JiaShare/JiaShareMenuView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// JiaShareMenuView.h
// jiaModuleDemo 从底部弹出菜单视图
//
// Created by wujunyang on 16/10/11.
// Copyright © 2016年 wujunyang. All rights reserved.
//

#import <UIKit/UIKit.h>

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
Loading

0 comments on commit ed9f568

Please sign in to comment.