Android的吐司相当于iOS中 [英] Android Toast equivalent in iOS
问题描述
有谁知道Java的吐司相当于这个iOS的Objective C的事件将是一个片段是什么? 下面是我自己编写的iOS中的一个样本。我正在寻找替代的iOS UIAlert的使用吐司相同的警报在Java中有什么。我很抱歉,如果我没有说清楚在我原来的职位。
- (无效)dateLogic {
NSDateFormatter * DATEFORMAT = [[NSDateFormatter页头]初始化];
[DATEFORMAT setDateFormat:@MMMM DD];
的NSString * theDate = [DATEFORMAT stringFromDate:[NSDate的日期]];
//一月
如果([theDate isEqualToString:@01月01日]){
feastDay = [[UIAlertView中页头]
initWithTitle:@新年快乐!
消息:@01月01日
代表:自我
cancelButtonTitle:无
otherButtonTitles:@关闭,零]
feastDay.delegate =自我;
[feastDay秀]
}
}
我发现这个惊人的类github上的作品就像一个魅力。 吐司的iOS 这足以导入的UIView + Toast.h和UIView的+ Toast.m文件,然后添加
[self.view makeToast:@这是一片土司];
如在页中写入的例子。
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];
}
}
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."];
as written in the page examples.
这篇关于Android的吐司相当于iOS中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!