IOS学习之路(二十五)UIView动画,弹出后移动然后消失
2013-10-27 19:43
239 查看
首先在viewdidload中添加UIlable并且把其设为隐藏
然后在点击按钮后,让其弹出移动后消失
//点击按钮后:
效果图:
然后在点击按钮后,让其弹出移动后消失
//点击按钮后:
#pragma mark 点击关注按钮 - (IBAction)guanzhuBtnClick:(id)sender { self.myAlertLabel=[[UILabel alloc] initWithFrame:CGRectMake(275, 85, 15, 15)]; //起始高度设的大点 self.myAlertLabel.text=@"+"; self.myAlertLabel.backgroundColor=[UIColor clearColor]; //背景色设为透明 self.myAlertLabel.hidden=YES; [self.view addSubview:self.myAlertLabel]; if (self.myAlertLabel.hidden==YES) { self.myAlertLabel.textColor=[UIColor grayColor]; self.myAlertLabel.hidden=NO; [UIView animateWithDuration:0.5 //动画时间 delay:0.0 //开始延迟时间 options: UIViewAnimationCurveEaseInOut //弹入弹出 animations:^{ self.myAlertLabel.frame = CGRectMake(275, 75, 15, 15); //终止高度设的小于起始高度 } completion:^(BOOL finished){ if (finished) [self.myAlertLabel removeFromSuperview]; //移动后隐藏 }]; } // self.myAlertLabel.hidden=YES; }
效果图:
相关文章推荐
- IOS学习之路(二十五)UIView动画,弹出后移动然后消失
- UIView逐渐变亮然后消失,动画
- [Phonegap+Sencha Touch] 移动开发19 某些安卓手机上弹出消息框 点击后不消失的解决办法
- UIView分类之动画移动效果
- android开发(31) 动画演示 - 从页面底部向上弹出dialog,消失时逐渐向下
- 不使用JS,使用CSS3 target 以及 动画效果实现,点击一下弹出,并且保持弹出状态,然后再点击一下弹回的导航栏(或者可以叫做按钮)
- 自定义popwindow,从底部弹出和消失动画
- android 自定义dialog弹出和消失缩放动画
- android动画特效之解决解决移动后闪烁现象,解决输入法弹出后位置回复原状,解决两个动画叠加
- 键盘弹出和消失View的上下移动效果
- 点击弹出全屏dialog 触摸消失 带动画
- UIView 弹出动画
- [js高手之路]html5 canvas动画教程 - 跟着鼠标移动消失的一堆炫彩小球
- android点击位于底部Edittext弹出输入法后标题栏向上移动消失
- android 给LinearLayout中添加一定数量的控件,并让着一定数量的控件从右到左移动,每隔若干秒停顿一下,最后一个view链接第一个view,然后继续移动循环往复,形成一个死循环简单动画效果
- UIView动画animation 水平移动UILabel
- Unity5.3.x带Rotation关键帧动画模型 移动平台运行时模型消失 PC正常
- android 自定义dialog弹出和消失动画
- popupwindow弹出和消失动画
- UIView动画【渐入alpha、淡出、移动frame、缩放transform、旋转transform rotation】