iOS 中的 Android Toast 等价物 [英] Android Toast equivalent in iOS
本文介绍了iOS 中的 Android Toast 等价物的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有谁知道 Java Toast 相当于这个iOS Objective C 事件会在 Fragment 中吗?下面是我在 iOS 中编写的示例.我正在使用 Toast 代替 iOS UIAlert 在 Java 中寻找相同的警报.如果我没有在我的原始帖子中说清楚,我很抱歉.
Does anyone know what the Java Toast equivalent of this iOS Objective C event would be in a Fragment? Below is a sample of what I have written in iOS. What I am looking for the same Alert in Java using a Toast in place of the iOS UIAlert. I am sorry if I did not make that clear on my original post.
- (void) dateLogic {
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"MMMM dd"];
NSString *theDate = [dateFormat stringFromDate:[NSDate date]];
//JANUARY
if ([theDate isEqualToString:@"January 01"]) {
feastDay = [[UIAlertView alloc]
initWithTitle:@"New Years Day!"
message:@"January 01"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"Close", nil];
feastDay.delegate = self;
[feastDay show];
}
}
推荐答案
我在 github 中发现了这个神奇的类,它的作用就像一个魅力.iOS 版 Toast导入UIView+Toast.h和UIView+Toast.m文件然后添加
I found this amazing class in github that works like a charm. Toast for iOS It is enough to import the UIView+Toast.h and UIView+Toast.m files and then add
[self.view makeToast:@"This is a piece of toast."];
如页面示例中所述.
这篇关于iOS 中的 Android Toast 等价物的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文