LMJDropdownMenu.h
2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
// LMJDropdownMenu.h
//
// Created by Jerry LMJ on 15/5/4.
// Copyright (c) 2015年 LMJ. All rights reserved.
//
#import <UIKit/UIKit.h>
@class LMJDropdownMenu;
NS_ASSUME_NONNULL_BEGIN
@protocol LMJDropdownMenuDataSource <NSObject>
@required
- (NSUInteger)numberOfOptionsInDropdownMenu:(LMJDropdownMenu *)menu;
- (CGFloat)dropdownMenu:(LMJDropdownMenu *)menu heightForOptionAtIndex:(NSUInteger)index;
- (NSString *)dropdownMenu:(LMJDropdownMenu *)menu titleForOptionAtIndex:(NSUInteger)index;
@optional
- (UIImage *)dropdownMenu:(LMJDropdownMenu *)menu iconForOptionAtIndex:(NSUInteger)index;
@end
@protocol LMJDropdownMenuDelegate <NSObject>
@optional
- (void)dropdownMenuWillShow:(LMJDropdownMenu *)menu; // 当下拉菜单将要显示时调用
- (void)dropdownMenuDidShow:(LMJDropdownMenu *)menu; // 当下拉菜单已经显示时调用
- (void)dropdownMenuWillHidden:(LMJDropdownMenu *)menu; // 当下拉菜单将要收起时调用
- (void)dropdownMenuDidHidden:(LMJDropdownMenu *)menu; // 当下拉菜单已经收起时调用
- (void)dropdownMenu:(LMJDropdownMenu *)menu didSelectOptionAtIndex:(NSUInteger)index optionTitle:(NSString *)title; // 当选择某个选项时调用
@end
@interface LMJDropdownMenu : UIView <UITableViewDataSource,UITableViewDelegate>
@property (nonatomic, weak) id <LMJDropdownMenuDataSource> dataSource;
@property (nonatomic, weak) id <LMJDropdownMenuDelegate> delegate;
@property(nonatomic,copy) NSString * title;
@property(nonatomic,strong) UIColor * titleBgColor;
@property(nonatomic,strong) UIFont * titleFont;
@property(nonatomic,strong) UIColor * titleColor;
@property(nonatomic) NSTextAlignment titleAlignment;
@property(nonatomic) UIEdgeInsets titleEdgeInsets;
@property(nonatomic,strong) UIImage * rotateIcon;
@property(nonatomic,assign) CGSize rotateIconSize;
@property(nonatomic,strong) UIColor * optionBgColor;
@property(nonatomic,strong) UIFont * optionFont;
@property(nonatomic,strong) UIColor * optionTextColor;
@property(nonatomic) NSTextAlignment optionTextAlignment;
@property(nonatomic) NSInteger optionNumberOfLines;
@property(nonatomic,strong) UIColor * optionLineColor;
@property(nonatomic,assign) CGSize optionIconSize; // default:(15,15)
@property(nonatomic,assign) CGFloat animateTime; // 下拉动画时间 default: 0.25
- (void)reloadOptionsData;
- (void)showDropDown; // 显示下拉菜单
- (void)hideDropDown; // 隐藏下拉菜单
@end
NS_ASSUME_NONNULL_END