-
Notifications
You must be signed in to change notification settings - Fork 88
/
SBTableAlert.h
68 lines (46 loc) · 1.98 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
//
// SBTableAlert.h
// SBTableAlert
//
// Created by Simon Blommegård on 2011-04-08.
// Copyright 2011 Simon Blommegård. All rights reserved.
//
#import <Foundation/Foundation.h>
@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
#define kNumMaximumVisibleRowsInTableView 4
#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;
@interface SBTableAlert : NSObject <UITableViewDelegate, UITableViewDataSource, UIAlertViewDelegate> {
UIAlertView *_alertView;
UITableView *_tableView;
SBTableAlertType _type;
id <SBTableAlertDelegate> _delegate;
id <SBTableAlertDataSource> _dataSource;
}
@property (nonatomic, retain) UIAlertView *view;
@property (nonatomic, retain) UITableView *tableView;
@property (nonatomic) SBTableAlertType type;
@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