显示在iOS中的消息具有相同的功能吐司Android中 [英] Displaying a message in iOS which has the same functionality as Toast in Android

查看:138
本文介绍了显示在iOS中的消息具有相同的功能吐司Android中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道是否有在iOS中其行为类似于Android的吐司消息的任何方法。也就是说,我需要显示这是几秒钟后自动关闭的消息。这是类似于吐司类的在Android环境的功能。

I need to know if there is any method in iOS which behaves like Toast messages in Android. That is, I need to display a message which is dismissed automatically after few seconds. This is similar to the functionality of the Toast class in the Android environment.

推荐答案

您可以使用 MBProgressHUD 项目。

You can make use of MBProgressHUD project.

使用HUD模式 MBProgressHUDModeText 的面包般的行为,

Use HUD mode MBProgressHUDModeText for toast-like behaviour,

MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];

// Configure for text only and offset down
hud.mode = MBProgressHUDModeText;
hud.labelText = @"Some message...";
hud.margin = 10.f;
hud.yOffset = 150.f;
hud.removeFromSuperViewOnHide = YES;

[hud hide:YES afterDelay:3];

希望帮助!

这篇关于显示在iOS中的消息具有相同的功能吐司Android中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆