I do not know much because it comes to graphics so I can use this tutorial to create a simple drawing view in my iPad I am trying to As a reference:
The problem I have is that the points drawn on the screen are closed in some cases where the finger is in fact. I believe this because it is an iPad app instead of an iPhone app, but seeing it with my uneducated eyes, I do not want to see why I need to change.
- (zero) touches: (NSSET *) touches the event: (UIEvent *) event {mouseSwiped = NO; UIT * touch = [touches any object]; If (touch [tapCount] == 2) {drawImage.image = nil; Return; } Last point = [Touch on location: see itself]; LastPoint.y - = 20; } - Increased touch (zero) touch: (NSASE *) touches the event: (UIEvent *) event {mouseSwiped = YES; UIT * touch = [touches any object]; CGPoint movepoint = [Touch Location Invoice: Self. Weave]; CurrentPoint.y - = 20; UIGraphicsBeginImageContext (self.view.frame.size); [DrawImage.image drawInRect: CGRectMake (0, 0, self.view.frame.size.width, self.view.frame.size.height)]; CGContextSetLineCap (UIGraphicsGetCurrentContext (), KCG Leneapreound); CGContextSetLineWidth (UIGraphicsGetCurrentContext (), 5.0); CGContextSetRGBStrokeColor (UIGraphicsGetCurrentContext (), 0.0, 0.0, 0.0, 1.0); CGContextBeginPath (UIGraphicsGetCurrentContext ()); CGContextMoveToPoint (UIGraphicsGetCurrentContext (), lastPoint.x, lastPoint.y); CGContextAddLineToPoint (UIGraphicsGetCurrentContext (), current Point.x, currentPoint.y); CGContextStrokePath (UIGraphicsGetCurrentContext ()); DrawImage.image = UIGraphicsGetImageFromCurrentImageContext (); UIGraphicsEndImageContext (); Final point = current page; MouseMoved ++; If (mouseMoved == 10) {mouseMoved = 0; }} - (zero) touched ended: (NSSET *) touches the event: (UIEVENT *) event {UITouch * Touch = [touches an object]; If (touch [tapCount] == 2) {drawImage.image = nil; Return; } If (! MouseSwip) {UIGraphicsBeginImageContext (self.view.frame.size); [DrawImage.image drawInRect: CGRectMake (0, 0, self.view.frame.size.width, self.view.frame.size.height)]; CGContextSetLineCap (UIGraphicsGetCurrentContext (), KCG Leneapreound); CGContextSetLineWidth (UIGraphicsGetCurrentContext (), 5.0); CGContextSetRGBStrokeColor (UIGraphicsGetCurrentContext (), 0.0, 0.0, 0.0, 1.0); CGContextMoveToPoint (UIGraphicsGetCurrentContext (), lastPoint.x, lastPoint.y); CGContextAddLineToPoint (UIGraphicsGetCurrentContext (), Last Point.x, Last Point.Y); CGContextStrokePath (UIGraphicsGetCurrentContext ()); CGContextFlush (UIGraphicsGetCurrentContext ()); DrawImage.image = UIGraphicsGetImageFromCurrentImageContext (); UIGraphicsEndImageContext (); }}
This code should work a lot in both the iPad and the iPhone. . From seeing that code where you are going to be reduced by 20 points ... lastpoint.y - = 20, so I hope that if any drawing is correct then it will be ensured that the user is due to that piece of code Touch it As I said earlier ... this code should do the same thing in both the iPad and the iPhone ...
Comments
Post a Comment