last day (15 days later) » 

5:27 PM
6
A: IOS line measurement on picture

ndmeiriThis idea looked like fun to implement, so I started a new project in Xcode and created a proof-of-concept. LineView (UIView subclass) This class is responsible for drawing two circles and a line connecting their centers. class LineView: UIView { var startPoint: CGPoint? var endPoint:...

 
Thank you so much ,, your logic is very helpful.. My bad I forgot to add objective-c in question.. But I am learning from ur code and trying to accomplish it in obj c,.... Great work
I am always getting touches count = 1 in the function updatePointsWithTouches(touches: Set<UITouch>) ... not sure why this is happening.... Any idea's?
 
Try adding self.multipleTouchEnabled = true to the setup() function in the image view subclass.
 
no luck.. Here is the gist gist.github.com/akhildave/0381f3aed55abbc9e730 Thanks
 
Oh my suggestion was in Swift. In Objective-C you would add self.multipleTouchEnabled = YES to the setup() function in the image view subclass. Does that work?
 
Multi touch is enabled on Image view also.. I checked with boolean flag if(self.self.multipleTouchEnabled) and it returns true... For some reason it doesn't work .. no luck yet.. am trying to solve it..
 
5:27 PM
@Dave Okay, I'm also trying to translate my code to Objective-C right now. Let me know if you figure it out.
@Dave Hmm, everything is working as expected for me. I translated it to Objective-C.
 
can u share the project code in github or gist.. I have issues on my end.. Thanks
 
@Dave Please see my updated answer.
 
InteractiveImageView is subclass of UiImageView and LineView is sub class of UiView right ? How have u inked it in above code. Please let me know.
 
@Dave That's correct.
Are you testing on a device or the simulator?
 
I get an error "Cannot find Interface declaration for LineView".. I use XCODE 6 and testing on simulator. Please update me
 
5:27 PM
@Dave Did you declare LineView in LineView.h?
When you test on the simulator are you holding down the option key on your keyboard?
You need to do that in order to interact with the simulator with two fingers.
 
Hi ndmeiri,, sorry to disturb you,.. but i really needed a quick help since i have less expertise on this
no.. i just touch and the start point vanishes
i am trying what you have suggested,, gimme a moment
 
That is the problem then. You need to touch the "screen" with two fingers.
 
ya i see line working..
it was my mistake
ok ,,, will this allow me to add more than two points.. I mean another line
is this any key for that,, or i should modify logic
 
Okay, I'm glad it worked. Please consider accepting my answer.
 
yes i will accept it
 
5:35 PM
Modifying the drawing logic and touch detection logic to add more than two points is up to you. The start I gave you should put you well on your way. Best of luck!
 
ok Thanks
Have a great day :) Many Thanks
 
You too :)
 

last day (15 days later) »