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

Using ratios to make drawing fit on iPad and iPhone

I'm trying to draw an (American) football field for both an iPad and iPhone device using UIBezierPath, by drawing 12 horizontal lines, two of which mark the beginning of the endzone. As you can see from below, the first line starts at the far left…
BrainLikeADullPencil
  • 11,313
  • 24
  • 78
  • 134
2
votes
1 answer

Overlapping Circular Buttons and Hit/Tap Testing

I am trying to create a Tabla drum app (a Table is a pair of small hand drums attached together). To do this I want to use a button for each section of the drum by putting one on top of another. Like so: I've tried using a circular image for the…
2
votes
1 answer

get CGPoint from coordinates of map OR get CGPoint from MKMapPoint iphone

Hello for a navigation based application i need to get CGPoint from coordinates OR MKMapPoint of a MKMapView. I want to draw a line between these points but not a poly line. I know all about MKPolyLine and other custom polyLines but due to some…
Nirav Gadhiya
  • 6,342
  • 2
  • 37
  • 76
2
votes
1 answer

Effect of fractional CGPoint with Core Graphics?

I'm doing some drawing relative to a scaled image so I end up with fractional CGPoints. I am scaling the results from the CoreImage face detection routine. Do I want to round these myself or leave it to iOS to do it when I use these points in…
spring
  • 18,009
  • 15
  • 80
  • 160
2
votes
2 answers

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

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?
2
votes
1 answer

Can't withdraw CGPoint Values from A mutableArray of NSValue

I made an NSMUtableArray of CGpoints and I stored them by subclassing as NSValue, but I cant get the values out. here I what I did. CGPoint graphPoint; NSMutableArray *pointValues = [[NSMutableArray alloc] init]; for( int x =0;x<5; x++) …
Terrel Gibson
  • 481
  • 1
  • 6
  • 21
2
votes
1 answer

Universal solution for storing CGPoint in NSArray in Cocoa and Cocoa Touch?

I have a class that I would like to share between a Cocoa and Cocoa Touch applications. This class calculates various CGPoints and stores them in an array. In Cocoa there's [NSValue valueWithPoint]. In Cocoa Touch there's [NSValue…
anna
  • 2,723
  • 4
  • 28
  • 37
2
votes
1 answer

Get starting point of Bezier Path in Core Graphics

I've been searching and I can't find the answer. I would like to get the starting point of a bezier path already in the view. I tried using the bounds, but that seems to get the 0,0 of a box around the path. currentpoint seems to be the last…
zambono
  • 1,397
  • 1
  • 17
  • 26
2
votes
3 answers

Sort Array of CGPoints

I am trying to figure out what the fastest/cleanest way to sort an array of CGPoints would be. I think I could achieve this using loops but that might not be the fastest and I hope it isn't the cleanest way. I would like to take an array of random…
daveMac
  • 3,041
  • 3
  • 34
  • 59
2
votes
1 answer

Check if CGPoint is close to another CGPoint

In my app, I have two buttons and a timer that fires an action every second. Each second, it generates four random numbers. The numbers are used as X and Y values of the buttons, and the buttons move to the new points. However, sometimes the new…
JohnWickham
  • 571
  • 1
  • 6
  • 15
2
votes
0 answers

Draw CGRect from array of CGPoints on iOS

I want to draw a rect from an array of cgpoint objects. I want to crop that rect from an UIImageView. I have done the cropping of the image, and I store all points from the touchesMoved delegate method into array. Now I want to draw an area from…
Gagan
  • 31
  • 3
2
votes
1 answer

Weird positioning issue when tabBar is present

We have a custom view with a UIPickerView plus toolbar (216 + 44). At init time (viewDidLoad) this custom view is pushed below the screen using the following piece of code. CGPoint newOrigin; newOrigin.x = pickerViewOutlet.frame.size.width/2; …
user1306828
  • 715
  • 7
  • 14
2
votes
1 answer

How to Display Admob at top of iPhone screen?

I've pretty much searched everywhere for the answer. // // GADAdSize.h // Google Ads iOS SDK // // Copyright 2012 Google Inc. All rights reserved. // // A valid GADAdSize is considered to be one of the predefined GADAdSize // constants or a…
CokePokes
  • 941
  • 3
  • 12
  • 25
1
vote
1 answer

affine translation prevents CGPoint relocation

I expanded and moved a label (instructionLabel), then returned it to its original size but left it in the new position. [UIView animateWithDuration:0.5 animations:^{ CGAffineTransform scale =…
Rob Smythe
  • 409
  • 1
  • 3
  • 16
1
vote
0 answers

Placing a UIImageView on screen, issue with conversion of UIView coordinates

I have problems getting the coordinate convertion from the local view frame to the window right. I have an "Arrow" image that needs to be moved relative to a UIButton on the page when tapped and when the page loads. The Arrow image (intense name…
Bernd
  • 11,133
  • 11
  • 65
  • 98