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
5
votes
1 answer

CGContextClearRect not working smoothly in touchesMoved event in objective c

I used this code, it works partly but image not crop properly output seen like this -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch = [touches anyObject]; CGPoint currentPoint = [touch…
5
votes
2 answers

Rotating a CGPoint around another CGPoint

Okay so I want to rotate CGPoint(A) 50 degrees around CGPoint(B) is there a good way to do that? CGPoint(A) = CGPoint(x: 50, y: 100) CGPoint(B) = CGPoint(x: 50, y: 0) Here's what I want to do:
Benja0906
  • 1,437
  • 2
  • 15
  • 25
5
votes
1 answer

CGPointMake explanation needed?

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
Rocker
  • 1,467
  • 5
  • 14
  • 20
4
votes
3 answers

How can encode array of CGPoint in Swift

Hello I found nice solution without array from here works OK @propertyWrapper struct EncodablePoint: Encodable { var wrappedValue: CGPoint enum CodingKeys: CodingKey { case x case y } func encode(to encoder: Encoder)…
Baldo
  • 41
  • 4
4
votes
1 answer

Get position of navigation bar item button in Swift

I want to get position(point) of my navigation item which is a button. If I can get this point I will be able to add a guide circle on my app. But I can't get this point right. let point = searchBarButton.center or let point =…
4
votes
1 answer

SwiftUI: UIkit UIbezier to SwiftUI Path

I am trying to convert UIBezierPath to SwiftUI Path I managed to do manually, by editing the bellow code: From: UIBezierPath controlPoint1: CGPoint(x: 1226.38, y: 0), controlPoint2: CGPoint(x: 1199.37, y: 0)) To: SwiftUI control1: CGPoint(x:…
Mane Manero
  • 3,086
  • 5
  • 25
  • 47
4
votes
2 answers

Cocoa-Touch: How to find out if CGPoint is in a certain CGRect?

I was wondering if there is a simple way to find out if a certain point is in a certain CGRect? I have this to get the position of where the user touched the screen: UITouch *touch = [touches anyObject]; CGPoint currentPosition = [touch…
n.evermind
  • 11,944
  • 19
  • 78
  • 122
4
votes
2 answers

Swift: make rotation of point in 2D

I want to make a rotation of point by -90 degrees Initial Final Let's take a look on top left and top right points of Initial. Their coordinates are: let topLeft = CGPoint(x: 2, y: 1) let topRight = CGPoint(x: 3, y: 1) And after rotation…
Kolkos
  • 43
  • 4
4
votes
3 answers

How to Programmatically Scroll iOS WKWebView, swift 4

So my question is: After a website(any websites on the www) has been loaded up in my iOS webview app how to make the app Programmatically Scroll vertically to any of the contents thats out of view? // ViewController.swift // myWebView import…
4
votes
2 answers

Select cell on scroll in collectionView by default

I have a custom collection view layout which seems to produce some bugs. Or maybe I'm missing something. Layout looks like this and it's from here: My problem is I can't pass the indexPath of the centered cell to pink button, call of…
Max Kraev
  • 740
  • 12
  • 31
4
votes
1 answer

Why are the positions of my nodes different on every device?

Ok, so I've been trying to position a line on my iPhone 6s+ and my iPad 2. The line was added in an SKCamera (I don't know if that effects it or not). Here is the code for the line: var leftWall = SKSpriteNode() leftWall.size = CGSize(width:…
Josh Schlabach
  • 401
  • 5
  • 17
4
votes
1 answer

Get Color of point in a SKScene swift

I need to get the color of a pixel/point for my game in Swift. So I tried to find a function that inputs a CGPoint and returns a Color, everything that I have found so far has only returned (0,0,0,0). I think that this is because I am doing this in…
joshLor
  • 1,034
  • 1
  • 12
  • 27
4
votes
1 answer

UITapGestureRecognizer Point Coordinates

I'm trying to implement a tap gesture recognizer into my app. Ideally I need for the tap gesture to return the x and y coordinates, so I can then create a variable to apply to a core image filter using a parameter which requires the x and y values.…
Henry
  • 41
  • 1
  • 2
4
votes
1 answer

Move four Rectangle's points simultaneously

I'm developing a macOS app that generates rectangles. I can separately move rectangles' points with left mouse button LMB. The principle of operation: when I drag 1 point with a LMB, the other 3 points will follow it at the same time with the same…
Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
4
votes
2 answers

How to Convert a SCNVector3 position to a CGPoint SCNView coordinate?

I have this app that just works in landscape. I have an object on scenekit. That object is at a certain position, specified by: SCNNode * buttonRef = [scene.rootNode childNodeWithName:@"buttonRef" recursively:YES]; SCNVector3 buttonRefPosition =…
Duck
  • 34,902
  • 47
  • 248
  • 470
1 2
3
33 34