Skip to content

Commit 9f67ede

Browse files
committed
重新设计
1 parent f42b5cf commit 9f67ede

File tree

13 files changed

+645
-513
lines changed

13 files changed

+645
-513
lines changed

Example/MLMenu/MLViewController.m

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@
66
// Copyright (c) 2018 MrDML. All rights reserved.
77
//
88

9+
#define MLClolor(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]
10+
#define k_ScreenHeight [UIScreen mainScreen].bounds.size.height
11+
#define k_ScreenWidth [UIScreen mainScreen].bounds.size.width
12+
#define k_StatusBarHeight [UIApplication sharedApplication].statusBarFrame.size.height
13+
#define k_NavigationBarHeight 44.f
14+
#define k_StatusBarAndNavigationBarHeight (k_StatusBarHeight + k_NavigationBarHeight)
915
#import "MLViewController.h"
10-
#import <MLMenu/MLMenu.h>
16+
#import <MLMenu/MLMenuView.h>
1117
@interface MLViewController ()
1218

1319
@end
@@ -47,7 +53,14 @@ - (void)testCode_One
4753
{
4854
NSArray *titles = @[@"发起群聊",@"添加朋友",@"扫一扫",@"收付款"];
4955

50-
MLMenuView *menuView = [[MLMenuView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 100 - 10, 0, 100, 44 * 4) WithTitles:titles WithImageNames:nil WithMenuViewOffsetTop:k_StatusBarAndNavigationBarHeight WithTriangleOffsetLeft:80];;
56+
MLMenuView *menuView = [[MLMenuView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 100 - 10, 0, 100, 44 * 4) WithTitles:titles WithImageNames:nil WithMenuViewOffsetTop:k_StatusBarAndNavigationBarHeight WithTriangleOffsetLeft:80 triangleColor:[UIColor whiteColor]];
57+
menuView.separatorOffSet = 10;
58+
menuView.separatorColor = MLClolor(51, 51, 51, 1);
59+
[menuView setMenuViewBackgroundColor:[UIColor whiteColor]];
60+
menuView.titleColor = [UIColor blackColor];
61+
62+
63+
[menuView setCoverViewBackgroundColor:MLClolor(51, 51, 51, 0.5)];
5164
menuView.didSelectBlock = ^(NSInteger index) {
5265
NSLog(@"%zd",index);
5366
};
@@ -60,7 +73,7 @@ - (void)testCode_Two
6073
NSArray *titles = @[@"发起群聊",@"添加朋友",@"扫一扫",@"收付款"];
6174
NSArray *images = @[@"scan",@"scan",@"scan",@"scan"];
6275

63-
MLMenuView *menuView = [[MLMenuView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 100 - 10, 0, 100, 44 * 4) WithTitles:titles WithImageNames:images WithMenuViewOffsetTop:k_StatusBarAndNavigationBarHeight WithTriangleOffsetLeft:80];
76+
MLMenuView *menuView = [[MLMenuView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 100 - 10, 0, 100, 44 * 4) WithTitles:titles WithImageNames:images WithMenuViewOffsetTop:k_StatusBarAndNavigationBarHeight WithTriangleOffsetLeft:80 triangleColor:nil];
6477
[menuView setCoverViewBackgroundColor:[UIColor lightGrayColor]];
6578
menuView.didSelectBlock = ^(NSInteger index) {
6679
NSLog(@"%zd",index);
@@ -73,7 +86,7 @@ - (void)testCode_Three
7386
{
7487
NSArray *titles = @[@"发起群聊",@"添加朋友",@"扫一扫",@"收付款"];
7588
NSArray *images = @[@"scan",@"scan",@"scan",@"scan"];
76-
MLMenuView *menuView = [[MLMenuView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 100 - 10, 0, 100, 44 * 4) WithTitles:titles WithImageNames:images WithMenuViewOffsetTop:k_StatusBarAndNavigationBarHeight WithTriangleOffsetLeft:80];
89+
MLMenuView *menuView = [[MLMenuView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 100 - 10, 0, 100, 44 * 4) WithTitles:titles WithImageNames:images WithMenuViewOffsetTop:k_StatusBarAndNavigationBarHeight WithTriangleOffsetLeft:80 triangleColor:nil];
7790
menuView.didSelectBlock = ^(NSInteger index) {
7891
NSLog(@"%zd",index);
7992
};
@@ -97,7 +110,7 @@ - (void)testCode_Five
97110
{
98111
NSArray *titles = @[@"发起群聊",@"添加朋友",@"扫一扫",@"收付款"];
99112

100-
MLMenuView *menuView = [[MLMenuView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 100 - 10, 0, 100, 44 * 4) WithTitles:titles WithImageNames:nil WithMenuViewOffsetTop:k_StatusBarAndNavigationBarHeight WithTriangleOffsetLeft:80];
113+
MLMenuView *menuView = [[MLMenuView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 100 - 10, 0, 100, 44 * 4) WithTitles:titles WithImageNames:nil WithMenuViewOffsetTop:k_StatusBarAndNavigationBarHeight WithTriangleOffsetLeft:80 triangleColor:nil];
101114
[menuView setCoverViewBackgroundColor:[UIColor lightGrayColor]];
102115
menuView.didSelectBlock = ^(NSInteger index) {
103116
NSLog(@"%zd",index);

Example/Pods/Pods.xcodeproj/project.pbxproj

Lines changed: 143 additions & 155 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Target Support Files/MLMenu/MLMenu-umbrella.h

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MLMenu.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'MLMenu'
11-
s.version = '0.1.7'
11+
s.version = '1.0.0'
1212
s.summary = 'A Simple MLMenu.'
1313

1414
# This description is used to generate tags and improve search results.

MLMenu/Classes/MLMenu.h

Lines changed: 0 additions & 21 deletions
This file was deleted.

MLMenu/Classes/MLMenuCell.h

Lines changed: 0 additions & 14 deletions
This file was deleted.

MLMenu/Classes/MLMenuCell.m

Lines changed: 0 additions & 105 deletions
This file was deleted.

MLMenu/Classes/MLMenuItem.h

Lines changed: 0 additions & 31 deletions
This file was deleted.

MLMenu/Classes/MLMenuItem.m

Lines changed: 0 additions & 29 deletions
This file was deleted.

MLMenu/Classes/MLMenuItemsView.h

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
//
2+
// MLMenuItemsView.h
3+
// MLMenu
4+
//
5+
// Created by 戴明亮 on 2018/5/29.
6+
//
7+
8+
#import <UIKit/UIKit.h>
9+
@class MLMenuItemsView;
10+
@protocol MLMenuItemsViewDelegate <NSObject>
11+
- (void)menuItemsView:(MLMenuItemsView *)itemView DidSelectItemAtIndex:(NSInteger)index;
12+
@end
13+
@interface MLMenuItemsView : UIView
14+
@property (nonatomic, copy) void (^menuDidSelectBlock)(NSInteger index);
15+
@property (nonatomic, weak) id <MLMenuItemsViewDelegate>delegate;
16+
@property (nonatomic, copy, nonnull) NSArray *titles;
17+
@property (nonatomic, copy, nullable) NSArray *imageNames;
18+
@property (nonatomic, strong, nullable) UIFont *font;
19+
@property (nonatomic, strong, nullable) UIColor *titleColor;
20+
@property (nonatomic, strong, nullable) UIColor *contentColor;
21+
@property (nonatomic, strong, nullable) UIColor *separatorColor;
22+
@property (nonatomic, assign) CGFloat separatorOffset;
23+
@property (nonatomic, assign) CGFloat separatorAlpha;
24+
- (instancetype)initWiithMenuItemTitles:(nonnull NSArray *)titles ImageNames:(NSArray *)imageNames;
25+
- (instancetype)initWithFrame:(CGRect)frame WiithMenuItemTitles:(nonnull NSArray *)titles ImageNames:(NSArray *)imageNames;
26+
@end
27+
28+
@class MLMenuItemView;
29+
@protocol MLMenuItemViewDelegate <NSObject>
30+
- (void)menuItemView:(MLMenuItemView *)itemView DidSelectItemAtIndex:(NSInteger)index;
31+
@end
32+
33+
@interface MLMenuItemView : UIView
34+
@property (nonatomic, copy, nullable) NSString *title;
35+
@property (nonatomic, copy, nullable) NSString *imageName;
36+
@property (nonatomic, strong, nullable) UIFont *font;
37+
@property (nonatomic, strong, nullable) UIColor *titleColor;
38+
@property (nonatomic, strong, nullable) UIColor *separatorColor;
39+
@property (nonatomic, assign) CGFloat separatorOffset;
40+
@property (nonatomic, assign) CGFloat separatorAlpha;
41+
@property (nonatomic, assign) BOOL isHiddenLin;
42+
@property (nonatomic, weak) id <MLMenuItemViewDelegate>delegate;
43+
- (instancetype)initWithTitle:(nonnull NSString *)title ImageName:(nullable NSString *)imageName WithAtIndex:(NSInteger)index;
44+
45+
@end
46+
47+
@interface MLButton: UIButton
48+
49+
50+
@end
51+
52+
@interface MLViewLin:UIView
53+
//- (void)setLineCustomeColor:(UIColor *)lineCustomeColor;
54+
@property (nonatomic,strong) UIColor *lineCustomeColor;
55+
@end
56+

0 commit comments

Comments
 (0)