码迷,mamicode.com
首页 > 移动开发 > 详细

IOS开发之类似Android中Toast效果制作

时间:2015-01-19 14:28:36      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:

ios中没有类似于Androidtoast效果的提示,在提示用户的时候显得尤为不便,因此做了一个类似Toast的功能.

UILabel *hintLabel = [[UILabel alloc] initWithFrame:CGRect(80,400,160,40)];

hintLabel.textAlignment = NSTextAlignmentCenter;

hintLabel.backgroundColor = [UIColor lightGrayColor];

hintLabel.alpha = 0.0;

hintLabel.text = @"提示字符...........";

[self.view addSubview:hintLabel];

//animateWithDuration可以控制label显示持续时间

[UIView animateWithDuration:1.0 animations:^{

hintLabel.alpha = 1.0;

} completion:^(BOOL finished){

[hintLabel removeFromSuperview];

}];

IOS开发之类似Android中Toast效果制作

标签:

原文地址:http://blog.csdn.net/violetic/article/details/42872329

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!