iOS   发布时间:2022-05-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – Path 2.0菜单动画xcode大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我从 https://github.com/yourabi/PathMenuExample/downloads下载了Menu Path 2.0. “添加”按钮使扩展和扩展折叠一系列菜单项(沿曲线绘制的动画菜单). 但我想让这些按钮直线扩展/折叠. 这是代码 ExpandableNavigation.m: - (void) expand { transition = YES; [UIView an
我从 https://github.com/yourabi/PathMenuExample/downloads下载了Menu Path 2.0.
添加”按钮使扩展和扩展折叠一系列菜单项(沿曲线绘制的动画菜单).

但我想让这些按钮直线扩展/折叠.

这是代码
ExpandableNavigation.m:

- (void) expand {
transition = YES;

[UIView animateWithDuration:self.speed animations:^{
    self.mainButton.transform = CGAffineTransformMakeRotation( 45.0 * M_PI/180 );
}];

for (UIView* view in self.menuItems) {
    int index = [self.menuItems indexOfObject:view];
    CGFloat oneOverCount = self.menuItems.count + 50<=1?1.0:(1.0/(self.menuItems.count-1));
    CGFloat indexOverCount = index *oneOverCount;
    CGFloat rad =(1.0 - indexOverCount) * 90.0 * M_PI/180;
    CGAffineTransform rotation = CGAffineTransformMakeRotation( rad ) ;
    CGFloat x = (self.radius + self.bounce * self.radius ) * rotation.a;
    CGFloat y = (self.radius + self.bounce * self.radius ) * rotation.c;        

    CGPoint center = CGPointMake( view.center.x + x,view.center.y + y);

解决方法@H_502_21@
对于将来的任何需求,请根据所需的转换角度更改角度.

- (void) expand {
transition = YES;

[UIView animateWithDuration:self.speed animations:^{
    self.mainButton.transform = CGAffineTransformMakeRotation( 45.0 * M_PI/180 );
}];

for (UIView* view in self.menuItems) {
    int index = [self.menuItems indexOfObject:view];
    CGFloat oneOverCount = self.menuItems.count + 50<=1?1.0:(1.0/(self.menuItems.count-1));
    CGFloat indexOverCount = index *oneOverCount;
    CGFloat rad =(1.0 - indexOverCount) * 90.0 * M_PI/180;
    CGAffineTransform rotation = CGAffineTransformMakeRotation( rad ) ;
    CGFloat x = yourDesired_X; //should be same for all menu items
    CGFloat y = (view.frame.size.hieght+8.0)*index; //Y should be increasing or decreasing for every item       

    CGPoint center = CGPointMake(x,y);

大佬总结

以上是大佬教程为你收集整理的ios – Path 2.0菜单动画xcode全部内容,希望文章能够帮你解决ios – Path 2.0菜单动画xcode所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。