首页 > 代码库 > STAlertViewDemo

STAlertViewDemo

效果图:

工程图:

注意,此工程需要导入第三方库STAlertView

 

RootViewController.m

//点击任何处,弹出按钮-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{    [self showTextFieldUIAlertView];}#pragma -mark -functions- (void)showNormalUIAlertView{    stAlertView = [[STAlertView alloc] initWithTitle:@"Super alert view"                                                  message:@"I‘m a native UIAlertView. Do you think I‘m useful?"                                        cancelButtonTitle:@"No, ofc"                                        otherButtonTitles:@"Yes a little bit"                                                                cancelButtonBlock:^{                                            NSLog(@"Why do you think I‘m not fancy :_( ");                                        } otherButtonBlock:^{                                            NSLog(@"Great! Feel free to contribute or contact me at twitter @NestorMalet!");                                        }];}- (void)showTextFieldUIAlertView{    stAlertView = [[STAlertView alloc] initWithTitle:@"Alert view with a textfield"                                                  message:@"I‘m a native UIAlertView with a textfiled."                                            textFieldHint:@"What do you think about me?"                                           textFieldValue:nil                                        cancelButtonTitle:@"Cancel"                                        otherButtonTitles:@"Store"                                                                cancelButtonBlock:^{                                            NSLog(@"Please, give me some feedback!");                                        } otherButtonBlock:^(NSString * result){                                            NSLog(@" You have said %@, but I can‘t store it :( . If you want, you can send it to me at hello@nestor.cat or via twitter @NestorMalet!", result);                                        }];}

 

源代码网址:http://url.cn/LSIrox

STAlertViewDemo