Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Adding demo code for BlockTableAlertView #59

Merged
merged 1 commit into from

2 participants

@jmyrose

Added a method in the demo to show a BlockTableAlertView. Not currently tied to any buttons in the UI.

@barrettj barrettj merged commit 9ba6dc3 into gpambrozio:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 19, 2013
  1. Adding demo code for BlockTableAlertView

    Jackie Myrose authored
This page is out of date. Refresh to see the latest.
View
1  BlockAlertsDemo/BlockAlertsDemoViewController.h
@@ -19,6 +19,7 @@
- (IBAction)arrivedBlog:(id)sender;
- (IBAction)dismissKeyboard:(id)sender;
- (IBAction)showTextPrompt:(id)sender;
+- (IBAction)showTableAlert:(id)sender;
@property (retain, nonatomic) IBOutlet UITextField *testKeyboard;
View
27 BlockAlertsDemo/BlockAlertsDemoViewController.m
@@ -10,6 +10,7 @@
#import "BlockAlertView.h"
#import "BlockActionSheet.h"
#import "BlockTextPromptAlertView.h"
+#import "BlockTableAlertView.h"
@implementation BlockAlertsDemoViewController
@synthesize testKeyboard;
@@ -98,6 +99,32 @@ - (IBAction)showTextPrompt:(id)sender
[alert show];
}
+- (IBAction)showTableAlert:(id)sender
+{
+ BlockTableAlertView *alert = [[BlockTableAlertView alloc] initWithTitle:@"Prompt Title" message:@"This is a simple table view"];
+
+ NSArray *sampleArray = [NSArray arrayWithObjects:@"Row 1", @"Row 2", @"Row 3", @"Row 4", @"Row 5", nil];
+ alert.numberOfRowsInTableAlert = ^(BlockTableAlertView *alertView){
+ return [sampleArray count];
+ };
+ alert.cellForRow = ^(BlockTableAlertView *alertView, NSInteger row){
+ static NSString *CellIdentifier = @"CellIdentifier";
+
+ UITableViewCell *cell = [alertView.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
+ if (!cell) {
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
+ }
+
+ cell.textLabel.text = [sampleArray objectAtIndex:row];
+
+ return cell;
+ };
+ alert.didSelectRow = ^(BlockTableAlertView *alertView, NSInteger row){
+ NSLog(@"Selected row: %d", row);
+ };
+ [alert show];
+}
+
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[self showAlert:nil];
Something went wrong with that request. Please try again.