Closed sabernar closed 11 years ago
Implement the following like they were your table data source:
@property (readwrite,copy) TableAlertIndexBlock didSelectRow;
@property (readwrite,copy) TableAlertCellSourceBlock cellForRow;
@property (readwrite,copy) TableAlertNumberOfRowsBlock numberOfRowsInTableAlert;
Can you provide an example of the TableAlertCellSourceBlock cellForRow method?
Here's the code I used that worked:
BlockTableAlertView *listView = [[BlockTableAlertView alloc] initWithTitle:@"Available Boards" message:@"Add webpage to board:"];
listView.type = BlockTableAlertTypeSingleSelect;
listView.numberOfRowsInTableAlert = ^(BlockTableAlertView* alertView){
return [boardsArray count];
};
listView.cellForRow = ^(BlockTableAlertView* alertView, NSInteger row){
static NSString *CellIdentifier = @"CellIdentifier";
UITableViewCell *cell = [alertView.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Set the data for this cell:
NEBoardsListItem *board = [boardsArray objectAtIndex:row];
cell.textLabel.text = board.title;
return cell;
};
listView.didSelectRow = ^(BlockTableAlertView* alertView, NSInteger row){
NSLog(@"Selected row: %d", row);
};
Also, just added a pull request with a demo of this.
There is no example, and the class is not very intuitive. Can you post an example?