Created
February 9, 2015 05:50
-
-
Save sinri/6677ad1c0af72693eb66 to your computer and use it in GitHub Desktop.
Block化進化したUIAlertView ref: http://qiita.com/sinri/items/17f565680f7026de49b8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SinriAlertView * sav=[[SinriAlertView alloc]initWithTitle:NSLocalizedString(@"_CashingCoupon_InputBox_Title", @"Cashing Coupon") | |
message:NSLocalizedString(@"_CashingCoupon_InputBox_Message", @"Input your coupon code to cashing.") | |
cancelButtonTitle:NSLocalizedString(@"Cancel", @"Cancel") | |
otherButtonTitles:NSLocalizedString(@"Confirm", @"Confirm"),nil]; | |
[sav setClickHandler:^(UIAlertView *sinriAlertView, NSInteger buttonIndex) { | |
NSLog(@"SinriAlertView ボタン index=%ld",buttonIndex); | |
if (buttonIndex == 1) { | |
UITextField *tf=[sinriAlertView textFieldAtIndex:0]; | |
NSString* cashCode = tf.text; | |
NSLog(@"SinriAlertView コード:%@",cashCode); | |
} | |
}]; | |
sav.alertViewStyle = UIAlertViewStylePlainTextInput; | |
[[sav textFieldAtIndex:0] setKeyboardType:UIKeyboardTypeNumberPad]; | |
[[sav textFieldAtIndex:0] becomeFirstResponder]; | |
[sav show]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment