MTLableAlertDemo, jquerymobiledemo
:
Project directory:
This Code requires a third-party library, MLTableAlert.
RootViewController. m
// Click anywhere and a prompt box appears-(void) touchesBegan :( NSSet *) touches withEvent :( UIEvent *) event {[self showTableAlert];}-(void) showTableAlert {// create the alert self. alert = [MLTableAlert tableAlertWithTitle: @ "Choose an option... "cancelButtonTitle: @" Cancel "numberOfRows: ^ NSInteger (NSInteger section) {// return 5;} andCells: ^ UITableViewCell * (MLTableAlert * anAlert, NSIndexPath * indexPath) {static NSString * CellIdentifier = @ "CellIdentifier"; UITableViewCell * cell = [anAlert. table partitions: CellIdentifier]; if (cell = nil) cell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: CellIdentifier]; cell. textLabel. text = [NSString stringWithFormat: @ "Section % d Row % d", indexPath. section, indexPath. row]; return cell;}]; self. alert. height = 350; [self. alert configureSelectionBlock: ^ (NSIndexPath * selectedIndex) {NSLog (@ "--- % d --", selectedIndex. section, selectedIndex. row);} andCompletionBlock: ^ {NSLog (@ "Cancel Button Pressed \ nNo Cells Selected");}]; [self. alert show];}
Source code: http://url.cn/NRRHBf