Skip to content

Commit

Permalink
THUI
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhuzhen6 committed Nov 7, 2018
1 parent 162cf2c commit b70a4c6
Show file tree
Hide file tree
Showing 31 changed files with 2,211 additions and 44 deletions.
15 changes: 15 additions & 0 deletions THUI.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Pod::Spec.new do |s|
s.name = 'THUI'
s.version = '1.0.0'
s.authors = { 'ZhuZhen' => '[email protected]' }
s.homepage = 'https://github.com/Zhuzhen6/THUI'
s.summary = 'a tool menu for ios like wechat homepage.'
s.source = { :git => 'https://github.com/Zhuzhen6/THUI.git',
:tag => s.version.to_s }
s.license = { :type => "MIT", :file => "LICENSE" }

s.platform = :ios, '10.0'
s.requires_arc = true
s.source_files = 'THUIDemo/THUI'
s.ios.deployment_target = '10.0'
end
106 changes: 100 additions & 6 deletions THUIDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,18 @@
9F00622D2192D184002C7DBC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9F00622C2192D184002C7DBC /* Assets.xcassets */; };
9F0062302192D184002C7DBC /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F00622E2192D184002C7DBC /* LaunchScreen.storyboard */; };
9F0062332192D184002C7DBC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F0062322192D184002C7DBC /* main.m */; };
9F00623C2192D1F1002C7DBC /* test.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F00623B2192D1F1002C7DBC /* test.m */; };
9F00624B2192DC76002C7DBC /* ToolButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F00623D2192DC75002C7DBC /* ToolButton.m */; };
9F00624C2192DC76002C7DBC /* NavTarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F00623F2192DC75002C7DBC /* NavTarView.m */; };
9F00624D2192DC76002C7DBC /* MenuBtnView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F0062412192DC75002C7DBC /* MenuBtnView.m */; };
9F00624E2192DC76002C7DBC /* ToolView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F0062452192DC75002C7DBC /* ToolView.m */; };
9F00624F2192DC76002C7DBC /* MenuView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F0062462192DC76002C7DBC /* MenuView.m */; };
9F0062502192DC76002C7DBC /* MoreToolView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F0062492192DC76002C7DBC /* MoreToolView.m */; };
9F0062512192DC76002C7DBC /* MoreToolCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F00624A2192DC76002C7DBC /* MoreToolCell.m */; };
9F0062602192DCA2002C7DBC /* TBCityIconFont.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F0062542192DCA2002C7DBC /* TBCityIconFont.m */; };
9F0062612192DCA2002C7DBC /* TBCityIconInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F0062552192DCA2002C7DBC /* TBCityIconInfo.m */; };
9F0062622192DCA2002C7DBC /* UIImage+TBCityIconFont.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F0062562192DCA2002C7DBC /* UIImage+TBCityIconFont.m */; };
9F0062632192DCA2002C7DBC /* FSCustomButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F00625E2192DCA2002C7DBC /* FSCustomButton.m */; };
9F0062642192DCA2002C7DBC /* CALayer+FSUI.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F00625F2192DCA2002C7DBC /* CALayer+FSUI.m */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -27,8 +38,32 @@
9F00622F2192D184002C7DBC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
9F0062312192D184002C7DBC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9F0062322192D184002C7DBC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
9F00623A2192D1F1002C7DBC /* test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = test.h; sourceTree = "<group>"; };
9F00623B2192D1F1002C7DBC /* test.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = test.m; sourceTree = "<group>"; };
9F00623D2192DC75002C7DBC /* ToolButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ToolButton.m; sourceTree = "<group>"; };
9F00623E2192DC75002C7DBC /* MoreToolCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MoreToolCell.h; sourceTree = "<group>"; };
9F00623F2192DC75002C7DBC /* NavTarView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NavTarView.m; sourceTree = "<group>"; };
9F0062402192DC75002C7DBC /* MenuBtnView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuBtnView.h; sourceTree = "<group>"; };
9F0062412192DC75002C7DBC /* MenuBtnView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MenuBtnView.m; sourceTree = "<group>"; };
9F0062422192DC75002C7DBC /* NavTarView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavTarView.h; sourceTree = "<group>"; };
9F0062432192DC75002C7DBC /* MenuView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuView.h; sourceTree = "<group>"; };
9F0062442192DC75002C7DBC /* ToolView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ToolView.h; sourceTree = "<group>"; };
9F0062452192DC75002C7DBC /* ToolView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ToolView.m; sourceTree = "<group>"; };
9F0062462192DC76002C7DBC /* MenuView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MenuView.m; sourceTree = "<group>"; };
9F0062472192DC76002C7DBC /* ToolButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ToolButton.h; sourceTree = "<group>"; };
9F0062482192DC76002C7DBC /* MoreToolView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MoreToolView.h; sourceTree = "<group>"; };
9F0062492192DC76002C7DBC /* MoreToolView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MoreToolView.m; sourceTree = "<group>"; };
9F00624A2192DC76002C7DBC /* MoreToolCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MoreToolCell.m; sourceTree = "<group>"; };
9F0062542192DCA2002C7DBC /* TBCityIconFont.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TBCityIconFont.m; sourceTree = "<group>"; };
9F0062552192DCA2002C7DBC /* TBCityIconInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TBCityIconInfo.m; sourceTree = "<group>"; };
9F0062562192DCA2002C7DBC /* UIImage+TBCityIconFont.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+TBCityIconFont.m"; sourceTree = "<group>"; };
9F0062572192DCA2002C7DBC /* TBCityIconInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TBCityIconInfo.h; sourceTree = "<group>"; };
9F0062582192DCA2002C7DBC /* TBCityIconFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TBCityIconFont.h; sourceTree = "<group>"; };
9F0062592192DCA2002C7DBC /* UIImage+TBCityIconFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+TBCityIconFont.h"; sourceTree = "<group>"; };
9F00625B2192DCA2002C7DBC /* FSCustomButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCustomButton.h; sourceTree = "<group>"; };
9F00625C2192DCA2002C7DBC /* CALayer+FSUI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CALayer+FSUI.h"; sourceTree = "<group>"; };
9F00625D2192DCA2002C7DBC /* FSCommenDefine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCommenDefine.h; sourceTree = "<group>"; };
9F00625E2192DCA2002C7DBC /* FSCustomButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCustomButton.m; sourceTree = "<group>"; };
9F00625F2192DCA2002C7DBC /* CALayer+FSUI.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CALayer+FSUI.m"; sourceTree = "<group>"; };
9F0062652192DEF3002C7DBC /* THUIHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = THUIHeader.h; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -78,12 +113,60 @@
9F0062392192D19F002C7DBC /* THUI */ = {
isa = PBXGroup;
children = (
9F00623A2192D1F1002C7DBC /* test.h */,
9F00623B2192D1F1002C7DBC /* test.m */,
9F0062652192DEF3002C7DBC /* THUIHeader.h */,
9F0062522192DCA2002C7DBC /* Vender */,
9F0062402192DC75002C7DBC /* MenuBtnView.h */,
9F0062412192DC75002C7DBC /* MenuBtnView.m */,
9F0062432192DC75002C7DBC /* MenuView.h */,
9F0062462192DC76002C7DBC /* MenuView.m */,
9F00623E2192DC75002C7DBC /* MoreToolCell.h */,
9F00624A2192DC76002C7DBC /* MoreToolCell.m */,
9F0062482192DC76002C7DBC /* MoreToolView.h */,
9F0062492192DC76002C7DBC /* MoreToolView.m */,
9F0062422192DC75002C7DBC /* NavTarView.h */,
9F00623F2192DC75002C7DBC /* NavTarView.m */,
9F0062472192DC76002C7DBC /* ToolButton.h */,
9F00623D2192DC75002C7DBC /* ToolButton.m */,
9F0062442192DC75002C7DBC /* ToolView.h */,
9F0062452192DC75002C7DBC /* ToolView.m */,
);
path = THUI;
sourceTree = "<group>";
};
9F0062522192DCA2002C7DBC /* Vender */ = {
isa = PBXGroup;
children = (
9F0062532192DCA2002C7DBC /* IconFont */,
9F00625A2192DCA2002C7DBC /* FSCustomBUtton */,
);
path = Vender;
sourceTree = "<group>";
};
9F0062532192DCA2002C7DBC /* IconFont */ = {
isa = PBXGroup;
children = (
9F0062542192DCA2002C7DBC /* TBCityIconFont.m */,
9F0062552192DCA2002C7DBC /* TBCityIconInfo.m */,
9F0062562192DCA2002C7DBC /* UIImage+TBCityIconFont.m */,
9F0062572192DCA2002C7DBC /* TBCityIconInfo.h */,
9F0062582192DCA2002C7DBC /* TBCityIconFont.h */,
9F0062592192DCA2002C7DBC /* UIImage+TBCityIconFont.h */,
);
path = IconFont;
sourceTree = "<group>";
};
9F00625A2192DCA2002C7DBC /* FSCustomBUtton */ = {
isa = PBXGroup;
children = (
9F00625B2192DCA2002C7DBC /* FSCustomButton.h */,
9F00625C2192DCA2002C7DBC /* CALayer+FSUI.h */,
9F00625D2192DCA2002C7DBC /* FSCommenDefine.h */,
9F00625E2192DCA2002C7DBC /* FSCustomButton.m */,
9F00625F2192DCA2002C7DBC /* CALayer+FSUI.m */,
);
path = FSCustomBUtton;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -155,9 +238,20 @@
buildActionMask = 2147483647;
files = (
9F0062282192D184002C7DBC /* ViewController.m in Sources */,
9F00623C2192D1F1002C7DBC /* test.m in Sources */,
9F0062632192DCA2002C7DBC /* FSCustomButton.m in Sources */,
9F00624B2192DC76002C7DBC /* ToolButton.m in Sources */,
9F0062642192DCA2002C7DBC /* CALayer+FSUI.m in Sources */,
9F0062622192DCA2002C7DBC /* UIImage+TBCityIconFont.m in Sources */,
9F00624F2192DC76002C7DBC /* MenuView.m in Sources */,
9F00624C2192DC76002C7DBC /* NavTarView.m in Sources */,
9F0062512192DC76002C7DBC /* MoreToolCell.m in Sources */,
9F0062602192DCA2002C7DBC /* TBCityIconFont.m in Sources */,
9F0062502192DC76002C7DBC /* MoreToolView.m in Sources */,
9F00624D2192DC76002C7DBC /* MenuBtnView.m in Sources */,
9F0062332192D184002C7DBC /* main.m in Sources */,
9F00624E2192DC76002C7DBC /* ToolView.m in Sources */,
9F0062252192D184002C7DBC /* AppDelegate.m in Sources */,
9F0062612192DCA2002C7DBC /* TBCityIconInfo.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Binary file not shown.
19 changes: 19 additions & 0 deletions THUIDemo/THUI/MenuBtnView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// MenuBtnView.h
// TH
//
// Created by TonghuiMac on 2018/11/6.
// Copyright © 2018 TonghuiMac. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "THUIHeader.h"
#import "ToolButton.h"
NS_ASSUME_NONNULL_BEGIN

@interface MenuBtnView : UIView
- (void)addBtn:(ToolButton *)btn;
@property (nonatomic, assign) CGFloat menuBtnViewWidth;
@end

NS_ASSUME_NONNULL_END
70 changes: 70 additions & 0 deletions THUIDemo/THUI/MenuBtnView.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//
// MenuBtnView.m
// TH
//
// Created by TonghuiMac on 2018/11/6.
// Copyright © 2018 TonghuiMac. All rights reserved.
//

#import "MenuBtnView.h"


@interface MenuBtnView ()
@property (nonatomic, strong) NSMutableArray <ToolButton *> *btnArray;
@property (nonatomic, strong) UIView *menuView;
@end


@implementation MenuBtnView

-(instancetype)initWithFrame:(CGRect)frame{
if (self = [super initWithFrame:frame]) {
[self addUI];
// self.menuBtnViewWidth = 0.0;
}
return self;
}

-(void)layoutSubviews{
[super layoutSubviews];
[self setBtnFrame];
}
- (void)addUI{

self.btnArray = [[NSMutableArray alloc]init];

self.menuView = [[UIView alloc] init];
self.menuView.backgroundColor = LEFT_SLIDE_HIGHTLIGHT_COLOR;
self.menuView.layer.cornerRadius = 6;
[self addSubview:self.menuView];
}

- (void)setBtnFrame{

CGFloat Size = 56;
CGFloat Width = 50;
CGFloat y0 = 1;
NSUInteger iConut = self.btnArray.count;
for (int i = 0; i<iConut; i++) {
self.btnArray[i].frame = CGRectMake(y0, 0, Width, Size);
y0 += Width;
}

self.menuBtnViewWidth = y0+5;
self.menuView.frame = CGRectMake(0, 0,self.menuBtnViewWidth, Size);

}


/**
添加btn到数组 视图
@param btn MenuButton
*/
- (void)addBtn:(ToolButton *)btn{

[self.btnArray addObject:btn];
[self.menuView addSubview:btn];
}

@end
23 changes: 23 additions & 0 deletions THUIDemo/THUI/MenuView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// MenuView.h
// TH
//
// Created by TonghuiMac on 2018/11/6.
// Copyright © 2018 TonghuiMac. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface MenuView : UIView
- (void)addView:(UIView *)view;
/**
退出按钮事件
*/
@property (nonatomic,copy) void (^ExitAction)(void);

- (void)closeMenuView;
@end

NS_ASSUME_NONNULL_END
81 changes: 81 additions & 0 deletions THUIDemo/THUI/MenuView.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
//
// MenuView.m
// TH
//
// Created by TonghuiMac on 2018/11/6.
// Copyright © 2018 TonghuiMac. All rights reserved.
//

#import "MenuView.h"
#import "THUIHeader.h"
#import "ToolButton.h"

@interface MenuView ()
@property (nonatomic, strong) NSMutableArray <UIView *> *viewArray;
@property (nonatomic, strong) UIView *menuView;
@end

@implementation MenuView

-(instancetype)initWithFrame:(CGRect)frame{
if (self = [super initWithFrame:frame]) {
[self addUI];
}
return self;
}

-(void)layoutSubviews{
[super layoutSubviews];
[self setBtnFrame];
}
- (void)addUI{

self.viewArray = [[NSMutableArray alloc]init];

self.menuView = [[UIView alloc] init];
self.menuView.backgroundColor = LEFT_SLIDE_HIGHTLIGHT_COLOR;
self.menuView.layer.cornerRadius = 4;
[self addSubview:self.menuView];
}

- (void)setBtnFrame{

CGFloat Size = 56;
CGFloat Width = 0;
CGFloat y0 = 1;
NSUInteger iConut = self.viewArray.count;
for (int i = 0; i<iConut; i++) {
Width = self.viewArray[i].frame.size.width;
self.viewArray[i].frame = CGRectMake(y0, 0, Width, Size);
y0 += Width;
}

ToolButton *exitBtn = [[ToolButton alloc]init];
[exitBtn btnWithName:@"退出" imgName:@"\U0000e916"];
exitBtn.frame = CGRectMake(y0+3, 0, 50, Size);
[exitBtn addTarget:self action:@selector(exitAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self.menuView addSubview:exitBtn];

CGFloat menuViewWidth = y0 + 50 + 3;
self.menuView.frame = CGRectMake(0, 0, menuViewWidth, Size);
}

- (void)addView:(UIView *)view{

[self.menuView addSubview:view];
[self.viewArray addObject:view];
}



-(void)exitAction:(UIButton*)btn{
[self closeMenuView];
if (self.ExitAction) {
[self ExitAction];
}
}

- (void)closeMenuView{
[self removeFromSuperview];
}
@end
17 changes: 17 additions & 0 deletions THUIDemo/THUI/MoreToolCell.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// MoreToolCell.h
// THZT
//
// Created by TonghuiMac on 2018/10/24.
// Copyright © 2018 TonghuiMac. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "ToolButton.h"
NS_ASSUME_NONNULL_BEGIN

@interface MoreToolCell : UICollectionViewCell
@property (nonatomic, strong) ToolButton *btn;

@end
NS_ASSUME_NONNULL_END
Loading

0 comments on commit b70a4c6

Please sign in to comment.