master
 1//
 2//  BlockTableAlertView.h
 3//  BlockAlertsDemo
 4//
 5//  Created by Barrett Jacobsen on 2/14/12.
 6//  Copyright (c) 2012 CodeCrop Software. All rights reserved.
 7//
 8
 9#import "BlockAlertView.h"
10
11@class BlockTableAlertView;
12
13typedef void (^TableAlertIndexBlock)(BlockTableAlertView*,NSInteger);
14typedef void (^TableAlertGeneralBlock)(BlockTableAlertView*);
15typedef NSUInteger (^TableAlertNumberOfRowsBlock)(BlockTableAlertView*);
16typedef UITableViewCell* (^TableAlertCellSourceBlock)(BlockTableAlertView*,NSInteger);
17
18#define kDefaultRowHeight 40.0
19#define kTableCornerRadius 5
20
21typedef enum {
22	BlockTableAlertTypeSingleSelect, // dismiss alert with button index -1 and animated (default)
23	BlockTableAlertTypeMultipleSelct, // dismiss handled by user eg. [alert.view dismiss...];
24} BlockTableAlertType;
25
26
27@interface BlockTableAlertView : BlockAlertView <UITableViewDelegate, UITableViewDataSource> {
28    UITableView *_tableView;
29	BlockTableAlertType _type;
30    
31    NSMutableArray *selectedItems;
32}
33
34@property (nonatomic, retain) UITableView *tableView;
35@property (nonatomic) BlockTableAlertType type;
36
37@property (readwrite,copy)	TableAlertIndexBlock didSelectRow;
38@property (readwrite,copy)	TableAlertIndexBlock willDismissWithButtonIndex;
39@property (readwrite,copy)	TableAlertGeneralBlock willPresent;
40@property (readwrite,copy)	TableAlertCellSourceBlock cellForRow;
41@property (readwrite,copy)	TableAlertNumberOfRowsBlock numberOfRowsInTableAlert;
42
43@property (nonatomic, assign) NSInteger maxSelection;
44
45@property (nonatomic, readonly) NSArray* indexPathsForSelectedRows;
46
47- (void)selectRowAtIndexPath:(NSIndexPath*)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scroll;
48
49- (id)initWithTitle:(NSString *)title message:(NSString *)message;
50
51- (void)reloadData;
52
53- (void)insertRowsAtIndexPaths:(NSArray*)rows;
54- (void)deleteRowsAtIndexPaths:(NSArray*)rows;
55
56+ (BlockTableAlertView *)tableAlertWithTitle:(NSString *)title message:(NSString *)message;
57
58@end