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

Resize UICollectionView Height

I'm trying to resize a UICollectionView height by setting it to 0 when the view controller is loaded, then increasing its size with an animation when a button is pressed. I've tried a few different things but it doesn't change in size at all. Here's…
Neil Faulkner
  • 526
  • 1
  • 4
  • 22
8
votes
5 answers

change UITextView height programmatically with the text

i want change the UITextView programmatically with the amount of text i set, and i have a problem, if i add a the UITextView with interface builder and i do this: CGRect frame = textViewA1.frame; frame.size.height =…
Piero
  • 9,173
  • 18
  • 90
  • 160
7
votes
1 answer

iOS: convertRect:toView: doesn't work as I expect

I'd like to have the coordinates relative to the main window, therefore I'm using convertRect:toView: with nil as second parameter: CGRect result = [self.view convertRect:addToList.frame toView:nil]; But as a result, I always get NSRect: {{5, 30},…
swalkner
  • 16,679
  • 31
  • 123
  • 210
7
votes
1 answer

How to free CGRect, CGPoint types in swift?

I am using CGRect, CGPoint types in my project several times. I can nill the swift objects but i cant set nil values to C types. How can i free CGRect and CGPoint from swift?
Antony Ouseph
  • 552
  • 4
  • 10
7
votes
1 answer

Objective C - Create UIImage from this PaintCode code

I am using PaintCode and it has generated some code to create a shape with text overlayed. I want to use the code to parse a string and generate a UIImage that I can save to the camera roll or share on FB, but I am struggling to generate the…
mwiggs
  • 157
  • 1
  • 8
7
votes
5 answers

CGRect Center for Ipad

I am creating an image frame using CGRect. I want to center the rectangle that is created. I've looked on here, as well as in the Apple documentation for the best way to do this, and found CGRectGetMidY and CGRectGetMidX which get the center…
aramirez
  • 87
  • 1
  • 1
  • 8
6
votes
3 answers

UIView bounds.applying but with rotation

I'd like to create a dash border around a view, which can be moved/rotated/scaled. Here's my code: func addBorder() { let f = selectedObject.bounds.applying(selectedObject.transform) borderView.backgroundColor = UIColor(red: 1,…
Makalele
  • 7,431
  • 5
  • 54
  • 81
6
votes
1 answer

Crop area different than Selected Area in iOS?

Here is link on github https://github.com/spennyf/cropVid/tree/master to try it out your self and see what I am talking about it would take 1 minute to test. Thanks! I am taking a video with a square to show what part of vid will be cropped. Like…
iqueqiorio
  • 1,149
  • 2
  • 35
  • 78
6
votes
1 answer

iOS - Get framing of Visible part of UIImage from UIImageView

I am trying to make a transition like APP Tinder. Detail: In Screen One there is a Vertical Rectangular UIImaveView with contentMode = Aspect Fill, so it hides some portion of Image to adujust Aspect Ratio. In Screen Two (Detail Screen) the same…
Mrug
  • 4,963
  • 2
  • 31
  • 53
6
votes
0 answers

Changing Frame Programmatically iOS 7?

BEFORE READING "iOS 7 OMG DOWNVOTE" The problem has been solved and is not related to iOS 7 at all. The problem was that with autolayout turned on, you cannot change the frame directly but must edit constraints instead. So I have an app that is…
WolfLink
  • 3,308
  • 2
  • 26
  • 44
6
votes
2 answers

Child content view controller view has wrong bounds size from Storyboard?

This document outline from my sample Storyboard shows what I'm working with. I have a custom container view controller and two content view controllers connected via embed segues. Here is the storyboard itself. ZetaViewController has to create…
Jeff
  • 3,829
  • 1
  • 31
  • 49
6
votes
3 answers

CGRectMake alternative

I have seen this alternative to using CGRectMake() in order to initialise a CGRect variable: CGRect frame = (CGRect){0,0,10,10}; My question is, how does CGRect frame = (CGRect){0,0,10,10}; work? What's going on behind the scenes? It looks like a…
Barjavel
  • 1,626
  • 3
  • 19
  • 31
5
votes
2 answers

CGRectContainsRect Not Working

I'm having problems with this method. I have two rectangles that are obviously contained within each other.(I've even graphed their coordinates manually to make sure.) When I use CGRectContainsRect to compare these two rectangles, it returns…
drucifer
  • 65
  • 1
  • 7
5
votes
4 answers

How to get frame size after autoresize is done

I wonder, how and when (viewDidLoad, viewWillAppear, viewDidAppear) can I get a UIViews frame size that was autoresized to fit its partent view?
Jakob
  • 1,126
  • 3
  • 16
  • 38
5
votes
1 answer

Cropping CGRect from AVCapturePhotoOutput (resizeAspectFill)

I have found the following problem and unfortunatly other posts have not helped me to a working solution. I have a simple app that shows the camera preview (AVCaptureVideoPreviewLayer) where the video gravity has been set to resizeAspectFill…
Robin
  • 704
  • 8
  • 24