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 [email protected] or via twitter @NestorMalet!", result);
                                        }];
}

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

时间: 2024-08-27 19:25:06

STAlertViewDemo的相关文章

STAlertViewDemo(仿密码修改)

效果图: 工程图: 此代码中需要引入第三方库STAlertView. 代码: RootViewController.h #import <UIKit/UIKit.h> //加入头文件 #import "STAlertView.h" @interface RootViewController : UIViewController { STAlertView *stAlertView; } @end RootViewController.m -(void)touchesBega