cgpoint

How can I create a UIView at a certain CGPoint?

笑着哭i 提交于 2019-12-30 13:28:27
问题 I need to be able to create and display a UIView at a a certain CGPoint. So far I have a gesture recogniser that is added as a subview to the main view. I then create a UIView programatically and set's it's x and y coordinates to the CGPoint that I got from the gesture recogniser. I am able to create it and add it as a subview but the position of the created UIView is different from the location of the TAP. AnimationView subclasses UIView My code is below tappedLocation = gesture

Coordinates all wrong on iPhone 3G? It could be your compiler

有些话、适合烂在心里 提交于 2019-12-28 06:45:13
问题 Note: This is question to which I have already found an answer. It seems that posting a question after finding an interesting answer is encouraged, so I am posting this. Someone else is likely to have the same problem and find this useful. I have an iOS app that produces charts. Shortly after publishing an update, a user sent me this panicky email: "the latest update has modified the curves ... not seen more growth curves and inserted data are represented as a line descending ... before you

Value of type 'CGPoint' has no member 'makeWithDictionaryRepresentation' in swift 3

拈花ヽ惹草 提交于 2019-12-25 08:58:45
问题 I am working with Swift 3. In my code I am using Siri integration in Wallet App.I am getting an error in that App. I searched in google for it but I didn't find the solution for it. Here is my code: func createPath(_ points: NSArray) -> UIBezierPath { let path = UIBezierPath() var point = CGPoint() //CGPointMakeWithDictionaryRepresentation((points[0] as! CFDictionary), &point) point.makeWithDictionaryRepresentation((points[0] as! CFDictionary)) // In this line I am getting an error path.move

More Precise CGPoint for UILongPressGestureRecognizer

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 02:16:29
问题 I am using a UILongPressGestureRecognizer which works perfectly but the data I get is not precise enough for my use case. CGPoints that I get are rounded off I think. Example points that I get: 100.5, 103.0 etc. The decimal part is either .5 or .0 . Is there a way to get more precise points? I was hoping for something like .xxxx as in '100.8745' but .xx would do to. The reason I need this is because I have a circular UIBezierPath, I want to restrict a drag gesture to only that circular path.

Moving UITextView cursor to a CGPoint

别等时光非礼了梦想. 提交于 2019-12-24 15:41:38
问题 Am trying to make a UITextView behave the way the one in Notes does, i.e. you tap to make it editable (turning off the data detectors) then the cursor moves to where you tapped. Got the tap-to-edit part working with a UITapGestureRecognizer , but how on earth do you translate the tap's CGPoint into a NSRange for moving the cursor? I don't have the luxury of doing this under 5.0 (no UITextInput for the UITextView , ack). Also needs to be public API's, no private stuff. Thanks in advance. :)

Getting all points (not only control points) from UIBezierPath

∥☆過路亽.° 提交于 2019-12-24 11:35:35
问题 I have a UIBezierPath which i defined, and i can access the relevant points defined. Now, i want to extract all the points in the line, not just the points i defined. I saw these following questions: Question 1 Question 2 And i was wondering if using the answers selected will give the result i want, meaning: 1) Extract all points (already have them) as suggested in question 1 2) Calculate all the points between each pair (or triplet) of points as suggested in question 2 Is this the right

What kind of data does apple use on GLPaint example?

删除回忆录丶 提交于 2019-12-24 10:09:11
问题 Few months ago i made an app based on apple GLPaint. It works great. I have recorded sets of points that draw simple drawings on the screen. and saved them as array of points (converted to NSValue). i am trying to improve my app now and i looked again at apple example. the data in their data file looks like that (i have changed it a little bit): <data> AAC8QgAAsEMAAMJCAICoQwAAwkIBBAKRDAADCQgCAnUMAAMJCAACYQwAAwEIAgJRDAADA QgCAkkMAAMBCAACRQwAAwEIAgJBDAADAQgCAkEM= </data> <data>

Is there any way to know which collection view cell is at a specific point?

梦想与她 提交于 2019-12-24 01:51:35
问题 I have a CGPoint and I would like to know which cell from my collection view currently contains that point. Is there any simple way to do this or do I have to write my own method? 回答1: I haven't used UICollectionView s much, but there's a method that seems perfect: - (NSIndexPath *)indexPathForItemAtPoint:(CGPoint)point; The point you pass to the method has to be within the coordinate system of the collection view. You can do: CGPoint convertedPoint = [collectionView convertPoint:point

CGPointMake explanation needed?

丶灬走出姿态 提交于 2019-12-22 06:52:21
问题 could anyone explain to me what CGPointMake does please? image.position = CGPointMake(80,200); id go = [MoveTo actionWithDuration:2 position:CGPointMake(190,460)]; for example this syntax above. I am not quite sure 回答1: It's an inline function that populates a CGPoint struct with the values you pass in. Command-double-click CGPointMake in your code and you will be taken to the header, which shows the function: CG_INLINE CGPoint CGPointMake(CGFloat x, CGFloat y) { CGPoint p; p.x = x; p.y = y;

Converting a CGPoint to NSValue

本小妞迷上赌 提交于 2019-12-18 04:34:43
问题 In CABasicAnimation.fromValue I want to convert a CGPoint to a "class" so I used NSValue valueWithPoint but in device mode or simulator one is not working... need to use NSMakePoint or CGPointMake if in device or simulator. 回答1: There is a UIKit addition to NSValue that defines a function + (NSValue *)valueWithCGPoint:(CGPoint)point See iPhone doc 回答2: @ashcatch 's answer is very helpful, but consider that those methods from addition copy values, when native NSValue methods store pointers!