facebook pop

来源:互联网 发布:怎么做网络水军 编辑:程序博客网 时间:2024/05/17 08:10
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"+" style:UIBarButtonItemStyleDone target:self action:@selector(showPop)];

- (void)showPop{

if (_isOpened) {
[self hidePop];
return;
}
_isOpened = YES;

POPSpringAnimation *positionAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewFrame];
positionAnimation.fromValue = [NSValue valueWithCGRect:_hidePosition];
positionAnimation.toValue = [NSValue valueWithCGRect:_showPosition];
positionAnimation.springBounciness = 15.0f;
positionAnimation.springSpeed = 20.0f;
[_popView pop_addAnimation:positionAnimation forKey:@"frameAnimation"];
}

- (void)hidePop{

POPBasicAnimation *positionAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewFrame];
positionAnimation.fromValue = [NSValue valueWithCGRect:_showPosition];
positionAnimation.toValue = [NSValue valueWithCGRect:_hidePosition];
//key一样就会用后面的动画覆盖之前的
[_popView pop_addAnimation:positionAnimation forKey:@"frameAnimation"];

_isOpened = NO;
}
代码实现了一个边角弹出菜单效果

原文链接 https://github.com/jxd001/POPdemo/blob/master/README.md
0 0
原创粉丝点击