-
Notifications
You must be signed in to change notification settings - Fork 5
/
SBTableAlert.h
89 lines (62 loc) · 2.55 KB
/
SBTableAlert.h
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
//
// SBTableAlert.h
// SBTableAlert
//
// Created by Simon Blommegård on 2011-04-08.
// Copyright 2011 Simon Blommegård. All rights reserved.
//
#import <Foundation/Foundation.h>
#define kNumMaximumVisibleRowsInTableView 8
#define kDefaultRowHeight 40.0
#define kTableCornerRadius 5
typedef enum {
SBTableAlertTypeSingleSelect, // dismiss alert with button index -1 and animated (default)
SBTableAlertTypeMultipleSelct, // dismiss handled by user eg. [alert.view dismiss...];
} SBTableAlertType;
typedef enum {
SBTableAlertStylePlain, // plain white BG and clear FG (default)
SBTableAlertStyleApple, // same style as apple in the alertView for slecting wifi-network (Use SBTableAlertCell)
} SBTableAlertStyle;
@class SBTableAlert;
@protocol SBTableAlertDelegate <NSObject>
@optional
- (void)tableAlert:(SBTableAlert *)tableAlert didSelectRow:(NSInteger)row;
- (void)tableAlertCancel:(SBTableAlert *)tableAlert;
- (void)tableAlert:(SBTableAlert *)tableAlert clickedButtonAtIndex:(NSInteger)buttonIndex;
- (void)willPresentTableAlert:(SBTableAlert *)tableAlert;
- (void)didPresentTableAlert:(SBTableAlert *)tableAlert;
- (void)tableAlert:(SBTableAlert *)tableAlert willDismissWithButtonIndex:(NSInteger)buttonIndex;
- (void)tableAlert:(SBTableAlert *)tableAlert didDismissWithButtonIndex:(NSInteger)buttonIndex;
@end
@protocol SBTableAlertDataSource <NSObject>
@required
- (UITableViewCell *)tableAlert:(SBTableAlert *)tableAlert cellForRow:(NSInteger)row;
- (NSInteger)numberOfRowsInTableAlert:(SBTableAlert *)tableAlert;
@end
@class SBTableAlertCellContentView;
@interface SBTableAlertCell : UITableViewCell {
SBTableAlertCellContentView *_cellContentView;
}
- (void)drawCellContentView:(CGRect)r;
@end
@class SBTableViewTopShadowView;
@class SBTableView;
@interface SBTableAlert : NSObject <UITableViewDelegate, UITableViewDataSource, UIAlertViewDelegate> {
UIAlertView *_alertView;
SBTableView *_tableView;
SBTableAlertType _type;
SBTableAlertStyle _style;
SBTableViewTopShadowView *_shadow;
BOOL _presented;
id <SBTableAlertDelegate> _delegate;
id <SBTableAlertDataSource> _dataSource;
}
@property (nonatomic, retain) UIAlertView *view;
@property (nonatomic, retain) UITableView *tableView;
@property (nonatomic) SBTableAlertType type;
@property (nonatomic) SBTableAlertStyle style;
@property (nonatomic, assign) id <SBTableAlertDelegate> delegate;
@property (nonatomic, assign) id <SBTableAlertDataSource> dataSource;
- (id)initWithTitle:(NSString *)title cancelButtonTitle:(NSString *)cancelTitle messageFormat:(NSString *)message, ...;
- (void)show;
@end