有谁知道Java Toast相当于这个 iOS objective-c 事件会在 fragment 中吗? 以下是我在 iOS 中编写的示例。我正在使用 Toast 代替 iOS UIAlert 在 Java 中寻找相同的警报。如果我没有在我的原始帖子中说明这一点,我很抱歉。
- (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 中发现了这个神奇的类,它的作用就像一个魅力。 Toast for iOS 导入 UIView+Toast.h 和 UIView+Toast.m 文件即可,然后添加
[self.view makeToast:@"This is a piece of toast."];
如页面示例中所写。
关于iOS 中的 Android Toast 等价物,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24893788/