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
12
votes
2 answers

CGpoint Vs CGPointMake

I have recently been introduced to swift. A question, when to use CGPoint and when shall I use CGPointMake ? I have interchanged these two statements and they both returned the same result self.anchorPoint = CGPointMake(0.5, 0.5) …
user2725255
  • 121
  • 1
  • 1
  • 3
11
votes
1 answer

Cant check if CGPoint is not equal CGPointZero

I have a CGPoint declared in a UIView class, in my viewController I try to check if that CGPoint is not equal to CGPointZero, but I get this error:Invalid operands to binary expression ('CGPoint' (aka 'struct CGPoint') and 'CGPoint') This is the…
Arbitur
  • 38,684
  • 22
  • 91
  • 128
10
votes
4 answers

Finding closest object to CGPoint

I have four UIViews on a UIScrollView (screen divided into quartiles) On the quartiles, I have a few objects (UIImageViews), on each quartile. When the user taps the screen, I want to find the closest object to the given CGPoint? Any ideas? I have…
Jordan
  • 21,746
  • 10
  • 51
  • 63
8
votes
1 answer

iPhone SDK: Convert MKMapPoint to CGPoint

I have converted a longitude and latitude on my MapView to a MKMapPoint. I then want to move an imageView to that point using the imageViews center property. It seems that I somehow need to convert the MKMapPoint to a CGPoint so that I can change…
Nic Hubbard
  • 41,587
  • 63
  • 251
  • 412
8
votes
2 answers

iOS get CGPoint from openCV cv::Point

In the above image ,we can see point which are drawn on image ,by some openCV algorithm. I want to draw a UIView point on those points ,so that user can crop it. I am not getting how will I access those points so that i can add uiview points. I…
Mukesh
  • 3,680
  • 1
  • 15
  • 32
8
votes
2 answers

Objective-c: How to rotate CGRect

I've tried to rotate my rectangle, but it does not work properly. Here is part of my code, I found it in another post: #define DEGREES_TO_RADIANS(x) (M_PI * x / 180.0) -(void)drawRect:(NSRect)rect { CGContextRef cRef = [[NSGraphicsContext…
YU FENG
  • 888
  • 1
  • 12
  • 29
7
votes
1 answer

Convert CLLocation or CLLocationCoordinate2D to CGPoint

How can I convert CLLocation or CLLocationCoordinate2D to CGPoint. I have seen CGPoint point = [mapView convertCoordinate:myCoordinates toPointToView:self.view]; But I don't need to use mapView in my case. I tried googling, but didn't come across…
Xavi Valero
  • 2,047
  • 7
  • 42
  • 80
7
votes
3 answers

Autolayout breaks UIView Animation

Struggling to make my app work on both the iPhone 5 and the smaller iPhone's prior. Would be happy to require iOS6 and use Autolayout because that works great. However, the app has 4 buttons that regularly swap positions, so I assign each button a…
William Robinson
  • 1,038
  • 17
  • 32
6
votes
3 answers

How do I properly observe the contentOffset property of my scrollView subclass?

In my iOS app I am observing changes to the contentOffset property of my scrollView subclass. My observer handler looks like this: - (void)observeContentOffsetHandler:(id)aContentOffset { NSLog(@"%@", aContentOffset); } I chose the parameter…
dugla
  • 12,774
  • 26
  • 88
  • 136
6
votes
0 answers

Image gets blurry and zoomed out when erasing

I am using functionality of erasing image and my code is like below. You can see Video HERE. Here current_sticker_img is my Imageview NOTE: I am also using Pan Gesture for zooming image //MARK: Eraser touch event override func touchesBegan(_…
Jitendra Modi
  • 2,344
  • 12
  • 34
6
votes
3 answers

finding location of specific characters in UILabel on iPhone

I have a UILabel with some text, say "Hello World abcdefg" The label can have multiple lines, different font sizes etc. Question: How do I find the coordinates of all letters "d" in this UILabel. Logical first step is find the position of those…
Nick
  • 2,626
  • 1
  • 26
  • 29
6
votes
2 answers

How to convert between vector_float2 and CGPoint*?

What's the easiest/fastest way to convert between vector_float2 and CGPoint* in Objective-C? Does Apple provide any built-in functionality for this kind of type conversion? I noticed in 2-3 places in sample apps they just call CGPointMake() etc. to…
CodeSmile
  • 64,284
  • 20
  • 132
  • 217
6
votes
2 answers

Arithmetic on two CGPoints with + or - operators

In Objective-C I'm starting to work with CGPoints and when I need to add two of them the way I'm doing it is this: CGPoint p1 = CGPointMake(3, 3); CGPoint p2 = CGPointMake(8, 8); CGPoint p3 = CGPointMake(p2.x-p1.x, p2.y-p1.y); I would like to be…
ndomin
  • 428
  • 4
  • 11
6
votes
1 answer

Initialisation of a CGPoint with { } notation

After CGPointMake let me down I found out that we can initalise a static const CGPoint like this instead: static const CGPoint p = { 0.f, 0.f }; It works but what is the curly bracket notation actually doing?
Danyal Aytekin
  • 4,106
  • 3
  • 36
  • 44
5
votes
3 answers

How to check to see if one view is on top of another view?

Currently there is a scrollview (whole screen) that sits behind a uiview (bottom portion of the screen). I"m trying to check whether or not a label on the scroll is covered by the uiview (this happens with iphone se). Is there a way to check if the…
SwiftyJD
  • 5,257
  • 7
  • 41
  • 92
1
2
3
33 34