呈现警报视图的一个好方法,添加颜色、文本,使用图片自定义,所有这一切都和添加一个字符串一样简单。
将主文件导入您的 Xcode 项目,并在需要显示视图的控制台中导入它
#import "RGLAlertView.h"
在您希望显示的视图中实例化视图并显示它。
RGLAlertView *view = [[RGLAlertView alloc] initWithBodyMessage:@"This is an alert view with a title" andDismissButtonText:@"Dismiss"];
[view setTitle:@"Alert with title"];
[view presentAlertViewWithAnimation:0];
RGLAlertView *view = [[RGLAlertView alloc] initWithBodyMessage:@"This is an alert view with a title" andDismissButtonText:@"Dismiss"];
[view setTitle:@"Alert with title"];
[view setBody:@"This is some random text, funny thing about it is that, based in my size, the alert is going to get bigger and bigger!"];
[view addButtonWithTitle:@"Touch"];
[view addImageInTop:[UIImage imageNamed:@"firstImage"]];
[view presentAlertViewWithAnimation:0];
有了代理,您将能够知道哪个按钮被点击。这很简单
view.delegate = self;
然后调用方法
- (void)buttonDidPressedWithTitle:(NSString *)string
{
NSLog(@"%@", string);
}
- (void)buttonDismissDidPressed
{
}
git checkout -b feature-branch
)。git commit -am 'Added this feature'
)。git push origin feature-branch
)。Ramon Gilabert 用爱! :)