- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想将一个 UIButton/UIView(红点)的中心定位在一个假想圆的边界上,作为另一个 UIView 的 subview ——这意味着坐标系是倒置的。
如何计算圆上红色框中心的 CGPoint。这是我所拥有的……
这是我正在尝试的(感谢@rmaddy)
CGFloat buttonX = circleCenter.x + cos(angleAsRadian) * radius;
CGFloat buttonY = circleCenter.y - sin(angleAsRadian) * radius;
CGPoint buttonCenter = CGPointMake(buttonX, buttonY);
UIButton* buttonMarker = [[UIButton alloc]initWithFrame:CGRectMake(0,0, 20, 20)];
[buttonMarker addTarget:self action:@selector(showTitle:) forControlEvents:UIControlEventTouchUpInside];
[buttonMarker setBackgroundColor:[UIColor greenColor]];
[buttonMarker setCenter:buttonCenter];
[_view addSubview:buttonMarker];
...和当前结果:
我实际上希望绿色按钮位于粉红色圆圈的顶部。所以还没有到那一步。
值(value)观:
最佳答案
导入<math.h>
并执行以下操作:
CGPoint circle = ... // the center of the circle
CGFloat angle = ... // the angle in radians
CGFloat radius = ...// the radius
CGFloat buttonX = circle.x + cos(angle) * radius;
CGFloat buttonY = circle.y - sin(angle) * radius;
CGPoint buttonCenter = CGPointMake(buttonX, buttonY);
如果您的角度以度为单位,则需要将其转换为弧度。
关于ios - 计算 subview 在 UIView 圆上的圆心坐标(倒坐标系),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23620515/
我想在 android 中扫描黑底白字条码。我使用过 zxing,它允许我只扫描白底黑字。我如何扫描和倒置条形码或使用哪个库?感谢您的帮助。 最佳答案 如果您仍在引用 journeyapps 嵌入式
所以我在 youtube 上观看了一些介绍性类(class)以学习 OpenGL 的基础知识并学习了诸如制作三角形和简单相机类等内容。我一直想尝试制作体素引擎,这显然是第一个我想做的是一个我最终可以复
这个问题在这里已经有了答案: Div with cut out edges, border and transparent background (6 个答案) 关闭 8 年前。
我有一张图片,我正在查看用 HTML 创建的小型网站的基本定制。 我知道您可以对图像进行倒 Angular 处理,如 this question here 中所示,这给出了 45 度切割。 我希望每个
我必须在 iOS 上创建一个自定义形状(倒 T)边框的 Uiview。我附上下面的截图。我进行了很多研究,找到了一种使用 here 中的 UIBezierPath 的方法. 但我不知道如何将我的 Vi
我是一名优秀的程序员,十分优秀!