Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在iPhone中创建电话拨号器效果?_Iphone_Core Animation - Fatal编程技术网

如何在iPhone中创建电话拨号器效果?

如何在iPhone中创建电话拨号器效果?,iphone,core-animation,Iphone,Core Animation,我想创建电话拨号器效果,那么我如何才能实现这种效果呢?。有任何API可用于此目的吗?我已经设置了图像在图像视图中,图像是圆形的。现在我想触摸并拖动图像,如果我拖动单个图像,它会将所有图像移动到特定路径。请看我的屏幕截图 请帮帮我 谢谢 创建视图(视图a)并将背景色设置为透明 将图像视图添加为子视图以查看 在视图A中重写以下方法: - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event { // Only return YES

我想创建电话拨号器效果,那么我如何才能实现这种效果呢?。有任何API可用于此目的吗?我已经设置了图像在图像视图中,图像是圆形的。现在我想触摸并拖动图像,如果我拖动单个图像,它会将所有图像移动到特定路径。请看我的屏幕截图

请帮帮我

谢谢

  • 创建视图(视图a)并将背景色设置为透明

  • 将图像视图添加为子视图以查看

  • 在视图A中重写以下方法:

    - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
    
    // Only return YES if the touch is in one of the subviews 
    //   - we dont care about touches that are just in this view
    
    for (UIView* view in self.subviews) {
    
        // We need to convert the point into the recievers co-ordinate system
        // (as per the documentation on 'pointInside:withEvent')
    
        CGPoint convertedPoint = [self convertPoint:point toView:view];
    
        if ([view pointInside:convertedPoint withEvent:event]) {
            return YES;
        }
    }
    return NO;
    }
    
  • 对移动的触碰做出响应,以更改视图A的中心点。如果需要围绕某个点旋转,则必须使用一些三角/数学


  • 您可以使用UIPangestureRecognitor检测父图像视图上的平移/拖动。然后应用CGAffineTransform,根据用户的手指位置旋转该视图

    // Calculate the rotation you want
    CGFloat radians = degreesToRadians(position*totalRotation);
    [dialerView setTransform:CGAffineTransformMakeRotation(radians)];
    

    您需要了解如何计算位置和总旋转。

    旋转电话拨号器api?现在人们期望太高了看看真正的电话。它们不会沿着路径移动孔。他们转动一个有孔的圆盘。我会尝试将所有图像放在一个视图中,并旋转该视图。