iphone:机械制图与设计层数
我需要画一些机械制图。我可以 (1) 显示部件的图像,
[self.view addSubview:thePartAsImageView];
(2) 实现两个滑块(一个水平的用于部件的宽度,一个垂直的用于部件的高度),
heightSlider .transform = CGAffineTransformRotate(heightSlider.transform, 270.0/180*M_PI);
(3) 当用户移动滑块时显示相应的值(尺寸),甚至 (4) 用箭头绘制尺寸线:
< code>CGContextAddLineToPoint
我不能做的是 (5) 在绘制这些线后删除它们。
我想要的是“如果 userTouchedTheHorizontalControl 则擦除TheLinesForTheVerticalControl。”
如果我理解正确的话——首先,Quartz 将所有内容合成为一个层,其次,CALayer、GeekGameBoard 等只能在 Mac 上运行——那么我必须做一些不同的事情。但是除了切换到 Open GL 之外我还能做些什么吗?
I need to do a bit of mechanical drawing. I can (1) display the part’s image,
[self.view addSubview:thePartAsImageView];
(2) implement two sliders (one horizontal for part’s width and one vertical for part’s height),
heightSlider.transform = CGAffineTransformRotate(heightSlider.transform, 270.0/180*M_PI);
(3) display the corresponding values (dimensions) as the user moves the sliders, and even (4) draw the dimensioning lines with arrowheads:
CGContextAddLineToPoint
What I can’t do is (5) remove those lines after I’ve drawn them.
What I want is “if userTouchedTheHorizontalControl then eraseTheLinesForTheVerticalControl.”
If I understand correctly – first, that Quartz composites everything to a single layer, and second, that CALayer, GeekGameBoard and so on only work on Mac -- then I have to do something different. But isn’t there something I can do other than switch to Open GL?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您能研究一下多点触控吗?在 iPhone 上,每个人都希望用两根手指捏合或展开来调整图像大小。在地图、照片中,任何地方都是一样的——如果采取不同的做法,你的应用程序就会感觉很奇怪。
如何在新的 UIView 上使用背景 [UIColor clearColor] 和 opaque=NO 在其他所有内容之上绘制尺寸线,然后在不再需要这些线时简单地删除该视图?
Can you look into multitouch - on an iPhone, everyone expects to pinch or expand with two fingers to resize an image. It's the same in maps, photos, everywhere - by doing it differently your app will feel strange.
How about drawing your dimension lines on a new UIView on top of everything else with background [UIColor clearColor] and opaque=NO, then simply removing that view when the lines are no longer required?