forked from dogo/SCLAlertView
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSCLButton.h
More file actions
executable file
·109 lines (91 loc) · 2.74 KB
/
SCLButton.h
File metadata and controls
executable file
·109 lines (91 loc) · 2.74 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
//
// SCLButton.h
// SCLAlertView
//
// Created by Diogo Autilio on 9/26/14.
// Copyright (c) 2014-2017 AnyKey Entertainment. All rights reserved.
//
#if defined(__has_feature) && __has_feature(modules)
@import UIKit;
#else
#import <UIKit/UIKit.h>
#endif
@class SCLTimerDisplay;
@interface SCLButton : UIButton
typedef void (^SCLActionBlock)(void);
typedef BOOL (^SCLValidationBlock)(void);
typedef NSDictionary* (^CompleteButtonFormatBlock)(void);
typedef NSDictionary* (^ButtonFormatBlock)(void);
// Action Types
typedef NS_ENUM(NSInteger, SCLActionType)
{
SCLNone,
SCLSelector,
SCLBlock
};
/** Set button action type.
*
* Holds the button action type.
*/
@property SCLActionType actionType;
/** Set action button block.
*
* TODO
*/
@property (copy, nonatomic) SCLActionBlock actionBlock;
/** Set Validation button block.
*
* Set one kind of validation and keeps the alert visible until the validation is successful
*/
@property (copy, nonatomic) SCLValidationBlock validationBlock;
/** Set Complete button format block.
*
* Holds the complete button format block.
* Support keys : backgroundColor, borderWidth, borderColor, textColor
*/
@property (copy, nonatomic) CompleteButtonFormatBlock completeButtonFormatBlock;
/** Set button format block.
*
* Holds the button format block.
* Support keys : backgroundColor, borderWidth, borderColor, textColor
*/
@property (copy, nonatomic) ButtonFormatBlock buttonFormatBlock;
/** Set SCLButton color.
*
* Set SCLButton color.
*/
@property (strong, nonatomic) UIColor *defaultBackgroundColor UI_APPEARANCE_SELECTOR;
/** Set Target object.
*
* Target is an object that holds the information necessary to send a message to another object when an event occurs.
*/
@property id target;
/** Set selector id.
*
* A selector is the name used to select a method to execute for an object,
* or the unique identifier that replaces the name when the source code is compiled.
*/
@property SEL selector;
/** Parse button configuration
*
* Parse ButtonFormatBlock and CompleteButtonFormatBlock setting custom configuration.
* Set keys : backgroundColor, borderWidth, borderColor, textColor
*/
- (void)parseConfig:(NSDictionary *)buttonConfig;
/** Set button timer.
*
* Holds the button timer, if present.
*/
@property (strong, nonatomic) SCLTimerDisplay *timer;
/** Init method
*
*/
- (instancetype)initWithWindowWidth:(CGFloat)windowWidth;
/** Adjust width of the button according to the width of the alert and
* the number of buttons. Only used when buttons are horizontally aligned.
*
* @param windowWidth The width of the alert.
* @param numberOfButtons The number of buttons in the alert.
*/
- (void)adjustWidthWithWindowWidth:(CGFloat)windowWidth numberOfButtons:(NSUInteger)numberOfButtons;
@end