iOS 中的 Android Toast 等价物

标签 android ios xamarin xamarin.ios toast

有谁知道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/

相关文章:

ios - 创建与 CGPathRef 垂直的线

android - 如何在 Xamarin 中安全地存储 key ?

xamarin - 如何在NET标准项目中使用nuget包,该包仅兼容portable-net45+win8+wp8+wpa81?

android - 在 Xamarin.Android 应用程序的情况下使用的 ORMLite 等效包是什么

Android Facebook 共享对话框的内容未显示在主页中

ios - 在 Swift 中对字典数组进行排序

android - android 上的外部(例如 facebook)联系人照片

ios - UICollectionView

android - 如何在android中的应用程序顶层设置页脚?

Android AudioRecord 和 AudioTrack 编解码器选项?