Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/41.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_Drawing - Fatal编程技术网

Iphone 如何制作绘图程序

Iphone 如何制作绘图程序,iphone,drawing,Iphone,Drawing,我并不期待在这里有一个非常详细的答案,只是希望能指出正确的方向 假设我想制作一个绘图程序,比如microsoft paint或应用程序draw之类的东西,我该怎么做 当我悬停并用鼠标单击时,我是否基本上设置了像素和附近像素的颜色作为厚度 我正计划制作一个应用程序,要求用户以简单的方式绘制内容,因此任何建议都会非常有用: 致以最良好的祝愿, Alexander为您的应用程序尝试此演示 它可能会对您有所帮助。UIBezierPath是在UIView上绘制线条的好选项。要绘制需要自定义视图的视图,不能

我并不期待在这里有一个非常详细的答案,只是希望能指出正确的方向

假设我想制作一个绘图程序,比如microsoft paint或应用程序draw之类的东西,我该怎么做

当我悬停并用鼠标单击时,我是否基本上设置了像素和附近像素的颜色作为厚度

我正计划制作一个应用程序,要求用户以简单的方式绘制内容,因此任何建议都会非常有用:

致以最良好的祝愿,
Alexander

为您的应用程序尝试此演示

它可能会对您有所帮助。

UIBezierPath是在UIView上绘制线条的好选项。要绘制需要自定义视图的视图,不能在UIViewController上绘制

并使用触摸代理方法绘制线条

声明UIBezierPath*bezierPath;在.h文件中

 -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    {
        bezierPath=[[UIBezierPath alloc]init];
        bezierPath.lineWidth = 5.0;

        UITouch *mytouch=[[touches allObjects] objectAtIndex:0];
        [bezierPath moveToPoint:[mytouch locationInView:self]];
     }
    -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
    {
        UITouch *mytouch=[[touches allObjects] objectAtIndex:0];
        [bezierPath addLineToPoint:[mytouch locationInView:self]];
        [self setNeedsDisplay];
    }
setNeedsDisplay将调用drawRect:方法

您可以使用setStroke:property更改Storke颜色。有关完整的想法,请参阅类参考。
希望此帮助对您有用

您可以尝试cocos2d:最受欢迎的花花公子:-
- (void)drawRect:(CGRect)rect
    {
  [bezierPath stroke];
    }