GZToast 是一个toast控件,它使用户能够在iOS应用程序中构建带有三种常见默认样式的toast视图。同时,开发人员还可以轻松插入自定义的toast内容。用户还可以定义自己的弹出时间和完成回调。
本项目现在支持屏幕旋转。
接下来是什么
pod install
。[[GZToastView toastWithText:@"toast style 1"] showForDuration:4
onCompletion:^{
NSLog(@"Toast complete");
}];
[[GZToastView toastWithText:@"toast style 2: icon with corresponding toast description. Adding the long desc to see the overall layout."
icon:[UIImage imageNamed:@"Icon.png"]]
showForDuration:4
onCompletion:^{
NSLog(@"Toast complete");
}];
[[GZToastView toastWithText:@"toast style 3: icon with corresponding toast description. Adding the long desc to see the overall layout."
icon:[UIImage imageNamed:@"Icon.png"]
title:@"Title"]
showForDuration:4
onCompletion:^{
NSLog(@"Toast complete");
}];
UIActivityIndicatorView* indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
indicator.frame = CGRectMake(0, 0, 55, 55);
[indicator startAnimating];
[[GZToastView toastWithCustomizedContent:indicator] showForDuration:4
onCompletion:^{
NSLog(@"Toast complete");
[indicator stopAnimating];
}];
由于这是一个小型项目,您也可以复制源代码到您的项目中。
GZToastView.h
GZToastView.m
至您的项目。
samuel.zhao.yue, [email protected]
Toast 可在 MIT 许可下使用。有关更多信息,请参阅 LICENSE 文件。