Questions tagged [cgrect]

CGRect is a structure from the ApplicationServices framework used with Apple's OSX and iOS operating systems. This structure is used to represent the origin and size of a rectangle.

CGRect is a structure that contains the location and dimensions of a rectangle.

Fields

  • origin: A point that specifies the coordinates of the rectangle’s origin.
  • size: A size that specifies the height and width of the rectangle.
716 questions
3
votes
1 answer

What happened to CGRectGetMidX() and CGRectGetMidY()?

I'm following a SpriteKit tutorial video from Rob Percival, and this line of code does not compile. It seems the syntax is out of date for getting the "mid x" and "mid y" values. What are the replacements for CGRectGetMidX() and…
Justin
  • 319
  • 3
  • 13
3
votes
2 answers

How to make the frame of a button custom shape in Swift 2

I want the button to be reactive to tap only in the custom polygonal shape that I create and not in the CGRect frame. button.frame only supports CGRect.
Fabio Laghi
  • 227
  • 1
  • 3
  • 6
3
votes
1 answer

What is the relationship between a UIView's frame origin and its center?

Say I'm creating an animation, and I want to move the center of a UIView to a certain CGPoint I have. I know what I want the center to be, just the aforementioned CGPoint, and I know the width and height that I want, but when I go to create the…
Doug Smith
  • 29,668
  • 57
  • 204
  • 388
3
votes
1 answer

Get position of UIButton in UITableViewCell

I have a button in a static UITableViewCell. What I want to do is place a UIView at the buttons location. If I just get the buttons position, it will give me a position relative to the tableviews cell, not from the top of the tableViewController.…
user4487951
3
votes
2 answers

How do I get rect for UICollectionView

I want to locate the frame of section header in UICollectionView. I have a similar situation for UITableView, and for that, I was able to get its rect by doing: CGRect rect = [self.tableView rectForHeaderInSection:section]; Is there a way to get…
tsuyoski
  • 614
  • 5
  • 22
3
votes
0 answers

Modified IBOutlet frame in Xcode 6.01

In storyboard I have a view with multiple views in it, in each view I have several subviews as well. In one of my subviews I have 3 images and 3 labels. The labels have 0 width because I set that later in code. Everything worked fine with Xcode 5…
Michal Shatz
  • 1,416
  • 2
  • 20
  • 31
3
votes
2 answers

UITableViewCell Circle Bullet Point

I've been trying to implement colorful circle bullet points like in the iOS Calendar app. I'd like to have cells with the circles in front of the textLabel like the image above. And I'd also like to have the corresponding circle in front of the…
Benck
  • 515
  • 1
  • 5
  • 17
3
votes
1 answer

Resize edit rect in image picker iOS

Is there any way to change the cropRect size for UIImagePickerController when using: imagePickerController.allowsEditing = YES; I want to set my own width and height depending on the image.
3
votes
2 answers

how to change height of uiview in tableview header

I have tableview, with a view as a child as the tableview header. I would like the view to grow in height based on interaction with a button on the navigation bar. I have tried to do this with the following without success: -…
Atma
  • 29,141
  • 56
  • 198
  • 299
3
votes
1 answer

how to get back a CGRect from an NSValue which is stored in a string

CGRect rect = Temp_3_Artwork_Big_Image.frame; NSLog(@"Rect : %.2f,%.2f,%.2f,%.2f",rect.origin.x,rect.origin.y,rect.size.width,rect.size.height); NSValue *value = [NSValue valueWithCGRect:rect]; NSLog(@"Value : %@",value); CGRect rect1 = [value…
Chirag Dj
  • 630
  • 2
  • 9
  • 27
3
votes
0 answers

How to convert a CGRect from portrait to landscape?

I would like to convert a CGRect frame that exists in a view of size 320 x 480 (portrait) to a view of size 640 x 480 (landscape left). I should note that I am testing on an iPhone 4S. However, I need to find a method generic enough for an iPhone 5,…
Christopher
  • 5,806
  • 7
  • 31
  • 41
3
votes
2 answers

Changing a view's bounds doesn't change where it draws

In viewDidLoad, I create a UIView at 100,100 with a size of 200x200, then change it's bounds to have an origin of -100,-100. I had supposed that this would either move the entire view back to the top left, or only draw a smaller rectangle for the…
nevan king
  • 112,709
  • 45
  • 203
  • 241
3
votes
2 answers

Keep UIView inside Circle Objective-C

How can I have my Color Selector (UIView) to stay inside a color wheel that's 300px 300px? Im using the UIPanGestureRecognizer to drag the Color Selector around the color wheel UIImageView. The diameter of the color wheel is 300px. Here is the…
atomikpanda
  • 1,845
  • 5
  • 33
  • 47
3
votes
1 answer

Find edges in an array of UIViews

Is there a way find the edges in an NSArray of UIViews. For instance, the diagram below shows a collection of UIViews (1 to 7). Each view abuts another view. So view 1 could be (0,0,70,20) and view 6 is (70,0,30,50). How would I return an array of…
cannyboy
  • 24,180
  • 40
  • 146
  • 252
3
votes
1 answer

Enlarge CGRect around existing point

I am using a CGRect to cut an image out of an imageview. The rectangle is generated automatically depending on features on the imageview but I would like to enlarge it slightly maybe by 10% but around the same point. To get the sizes of something I…
EHarpham
  • 602
  • 1
  • 17
  • 34