美文网首页
一个简单IOS View动画效果

一个简单IOS View动画效果

作者: 花开花非花 | 来源:发表于2017-04-11 20:28 被阅读0次

@property (strong ,nonatomic) UIView *Myview;

if (self.Myview == nil) {

self.Myview = [[UIView alloc]initWithFrame:CGRectMake(0, 100, 50, [UIScreen mainScreen].bounds.size.height)];

[self.view addSubview:self.Myview];

[self.Myview setBackgroundColor:[UIColor redColor]];

}

CGRect Temp = self.Myview.frame;

Temp.origin.x = [UIScreen mainScreen].bounds.size.width;

self.Myview.frame = Temp;

Temp.origin.x = 90;

[UIView animateWithDuration:0.8 animations:^{

self.Myview.frame = Temp;

}];

喜欢的小伙伴可以顶赞一下,或者打赏一下,不定期更新

相关文章

网友评论

      本文标题:一个简单IOS View动画效果

      本文链接:https://www.haomeiwen.com/subject/hbguattx.html