简体   繁体   English

iPhone:机械制图和图层

[英]iphone: mechanical drawing & layers

I need to do a bit of mechanical drawing. 我需要做一些机械制图。 I can (1) display the part's image, 我可以(1)显示零件的图像,

[self.view addSubview:thePartAsImageView];

(2) implement two sliders (one horizontal for part's width and one vertical for part's height), (2)实现两个滑块(一个水平用于表示零件的宽度,一个垂直用于表示零件的高度),

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: (3)在用户移动滑块时显示相应的值(尺寸),甚至(4)用箭头绘制尺寸线:

CGContextAddLineToPoint

What I can't do is (5) remove those lines after I've drawn them. 我不能做的是(5)在绘制线条后将其删除。

What I want is “if userTouchedTheHorizontalControl then eraseTheLinesForTheVerticalControl.” 我想要的是“如果userTouchedTheHorizo​​ntalControl然后擦除TheLinesForTheVerticalControl。”

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. 如果我理解正确的话–首先是Quartz将所有内容组合到一个图层中,然后是CALayer,GeekGameBoard等仅在Mac上运行–然后,我必须做些不同的事情。 But isn't there something I can do other than switch to Open GL? 但是,除了切换到Open GL之外,我是否还能做些其他事情?

Can you look into multitouch - on an iPhone, everyone expects to pinch or expand with two fingers to resize an image. 你可以看看多点触控 - 在iPhone上,每个人都希望掐或用两个手指展开调整图像大小。 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? 如何在具有背景[UIColor clearColor]和opaque = NO的所有其他对象之上的新UIView上绘制尺寸线,然后在不再需要这些线时简单地删除该视图?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM