Questions tagged [cgpoint]

CGPoint is a structure from Apple's Core Graphics framework. It is used to represent a point in two dimensions.

CGPoint is a C struct that contains information about the location of a point in two dimensions.

Fields:

  • x: The X location of the point
  • y: The Y location of the point
509 questions
1
vote
3 answers

Comparing CGPoint and image center property

I could really do with some help here. I've spent the past couple of hours trying to work out how to compare the value of a CGPoint and the center property of an image. I had assumed the two values were in the form of x and y coordinates. Below is…
garethdn
  • 12,022
  • 11
  • 49
  • 83
1
vote
1 answer

Draw a irregular polygon on iphone

i have this question: i have a array of points and i would draw a irregular polygon by this points with Quartz or similar. Can you suggest me the best way to make this? MyTest drawRect is this: - (void)drawRect:(CGRect)rect { CGContextRef ctx =…
Safari
  • 11,437
  • 24
  • 91
  • 191
1
vote
1 answer

CGPoint inside CGImageRef

Can I know if a CGPoint is inside a CGImageRef? Or I should convert CGImageRef in other format? UPDATE maskcontext = CGBitmapContextCreate(currentM, w, h, …
cyclingIsBetter
  • 17,447
  • 50
  • 156
  • 241
1
vote
1 answer

How can I store the path of finger movement in objective c?

I want to store the path of finger movement on iPhone screen. As of now I am just reading touches and adding CGPoints to NSMutableArray. when I try to print the all cgpoint in that array some how it is missing intermediate points. Is there a better…
slonkar
  • 4,055
  • 8
  • 39
  • 63
1
vote
1 answer

Moving UITextView cursor to a CGPoint

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…
GB540
  • 121
  • 5
1
vote
1 answer

use CGPoint as an array

I want to use an function to pass a lot of points to another function, but the Xcode has errors on the line with: CGContextAddLines...... the add points is filled with information like: CGPoint addPoints[] = { CGPointMake(10,10), …
RNB-IT
  • 245
  • 1
  • 2
  • 5
1
vote
3 answers

How to cycle through an array of CGPoints

I have created an array of 16 CGpoints representing 16 positions on a game board. This is how i set up the array CGPoint cgpointarray[16]; I would like to create a for loop to cycle through each item in the array and check if the touch is within x…
Puregame
  • 11
  • 2
1
vote
1 answer

How do I scale CGPoint based on CGSize changes?

I have CGRect with a default (square) size. The size is adjustable based on the view controllers needs, but always maintains a square proportion. If I want to plot a point within the rect, but the scale of the rect is variable up and down in size,…
TigerCoding
  • 8,710
  • 10
  • 47
  • 72
1
vote
3 answers

xcode put CGPoint x value on a label.text

I try to put the value of lastPointX into a label text, but doesn't work. In the Interface Builder, I create two labels, the label for "x" value and the label for "y" value. Please If anyone knows the solution, please answer the…
nioan7
  • 19
  • 2
  • 8
1
vote
2 answers

iOS - Get CGRect around CGPoints

I have array of CGPoint indicated in red. I must connect all consecutive points with CGRect as shown in the rough figure to form an array of CGRect. Consider all rect has a constant width and each point could be the mid point of the sides formed…
iOS
  • 3,526
  • 3
  • 37
  • 82
1
vote
1 answer

How to Add Line between two UIView centers in Swift?

As you can see in the Image attached, there are red and green Views on the screen, I want to add a Line between them. How can I do that?
Akash Neeli
  • 337
  • 4
  • 12
1
vote
1 answer

Current coordinates of a tableViewCell swift

fellows! I'm trying to make an animation of an image in my tableViewCell. My intent is to get an imageView that is in a tableViewCell, add it to exactly the same place in a view, and then use scale animation. Currently, my code looks as below,…
imnikita
  • 21
  • 6
1
vote
1 answer

Find points between two CGPoints

Trying to find nearest points between start and end point. Points Array : let pointsArray = [(10.0, 10.0), (70.0, 10.0), (10.0, 200.0), (70.0, 200.0), (73.0, 10.0), (133.0, 10.0), (73.0, 200.0), (133.0, 200.0), (135.5, 10.0), (195.5, 10.0), (135.5,…
Code cracker
  • 3,105
  • 6
  • 37
  • 67
1
vote
2 answers

iPhone - CGPoint distance in pixels and screen resolution

I have this code into the - (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context method (into a MKOverlayView subclass) to prevent drawing segments that are less than 10 pixels long on a map overlay…
Oliver
  • 23,072
  • 33
  • 138
  • 230
1
vote
1 answer

SpriteKit weird behaviour of SKSpriteNode property

I'm moving my first steps into SpriteKt and found this apparently weird behaviour of the SkSpriteNode.position property: it should be a CGPoint, but when assigned and read back, it behaves differently of any other CGPoint. In the code that follows I…
Luca
  • 303
  • 2
  • 13