Questions tagged [cgrectmake]

CGRectMake is used in iOS, it returns a rectangle with the specified coordinate and size values.

CGRectMake is used in iOS (), it returns a rectangle with the specified coordinate and size values.

CGRect CGRectMake (
  CGFloat x,
  CGFloat y,
  CGFloat width,
  CGFloat height
);
  • x: The x-coordinate of the rectangle’s origin point.
  • y: The y-coordinate of the rectangle’s origin point.
  • width: The width of the rectangle.
  • height: The height of the rectangle.
153 questions
4
votes
1 answer

What the most useful Core Graphics (CGrect) functions?

I usually use CGRectMake method for all my code. Are there other useful handy methods ?
Abhishek Bedi
  • 5,205
  • 2
  • 36
  • 62
3
votes
4 answers

iOS Programmatically Center Objects

I am updating an app for iPhone 6 Plus support. On one of the views that is set up programmatically, running on 5S or below has all views centered the way they should be. However, on the 6 Plus, it is scooted over slightly to the left. How can I…
user717452
  • 33
  • 14
  • 73
  • 149
3
votes
2 answers

Xcode 6 Beta 5 Swift Playground: Cannot find symbol for CGRectMake()

Since updating to Xcode 6 beta 5 my playground code will no longer compile/run and logs: Playground execution failed: error: Couldn't lookup symbols: _CGRectMake It should be simple enough and worked fine on the previous versions. The only code I…
jaco129
  • 127
  • 6
3
votes
4 answers

CGRectMake putting my UIButton in the wrong location

When I use CGRectMake in my program, it behaves very strangely. In Interface Builder, my button has coordinates of (260, 388) and is always in portrait mode. When I put in the following code (just to experiment), which should keep it in the same…
robertfiorentino
  • 584
  • 7
  • 20
3
votes
2 answers

iOS Error with GCRectMake - Sending 'int' to parameter of incompatible type 'CGRect' (aka 'struct CGRect')

I'm new in the iOS programming. I am following a guide, a book precisely on iOS in Italian. For the first application, I have to modify ViewController.m like this: #import "ViewController.h" @implementation ViewController -…
luke88
  • 958
  • 19
  • 40
3
votes
1 answer

iOS: What is CGRect doing when I see strange calculated values during debugging?

I'm trying to resolve a spacing issue while drawing to a PDF. In debugging, I am watching the method that constructs a rectangle for my string (see below). As I watch the values in the debugger, they go from nice float values (ie., 30.0) to what you…
cmac
  • 906
  • 10
  • 19
2
votes
1 answer

UIView resizing but not the SubViews

I have an UIView (v1): --------------- | --------- | | | | | | | | | | | | | | | UIImage | | | | View | | | --------- | | UIView | --------------- With an UIImageView (img1) as…
user1126886
2
votes
3 answers

Setting UICollectionView frame at runtime

I am trying to set the frame of my UICollectionView at runtime. I tried using mainCollectionView.frame = CGRect(x: 20, y: 20, width: self.view.frame.width-20, height: self.view.frame.width-20) in my viewDidLoad but unfortunately it will always…
JVS
  • 2,592
  • 3
  • 19
  • 31
2
votes
3 answers

Swift - Automatically adding a button to the right of the button just added

I have a UIScrollView set up, and am using addSubView to add 5 buttons to it. Here is the code inside my viewDidLoad. let codedButton:UIButton = UIButton(frame: CGRectMake(0, 0, 100, 50)) codedButton.backgroundColor = UIColor.redColor() …
Joe
  • 3,772
  • 3
  • 33
  • 64
2
votes
3 answers

UIView Frame Size Didn't Change UIImageView Placed inside it

I'm making a picture in a frame and then user can resize the frame size in runtime. For this purpose I've made a custom UIView in my main UIViewController and inside this UIView I've placed 2 UIImageView. In Document Outline Pane of xCode it's…
Chaudhry Talha
  • 7,231
  • 11
  • 67
  • 116
2
votes
1 answer

Programmatically create subview that covers the top 50% of the iPhone screen

I have a subview and I have been customizing its size by using the frame property and setting its value to the CGRectMake function's parameter values. I have slowly but surely been changing the CGRectMake parameters and re-running the app to get…
user3117509
  • 833
  • 3
  • 14
  • 32
2
votes
3 answers

Can't remove a label programmatically

I am printing a label programmatically but I can't remove it from the screen. I have tried removeFromSuperview and lbl1.hidden = YES; and lbl1= nil; but non of them work. It stays on the screen all the time while I can see in the debug it pass from…
Luai Kalkatawi
  • 1,492
  • 5
  • 25
  • 51
2
votes
1 answer

Adding UITextView as Subview to Map View Causes Unwanted Recenter.

In my project, I use a button, that when pressed adds a UITextView (textWindow) to a map view (mapView). The issue is when you add the UITextView after you have navigated away from the user's current location on the map. When you add the UITextView…
user2621075
  • 357
  • 4
  • 15
2
votes
1 answer

ios - Rectangles with borders overlapping

I have a strange problem when I try to draw rectangles which overlap one another. See the image below: As you can see, the top line is ticker than others (bottom and vertical ones), in particular ticker than the line separating the rectangles. I…
gdm
  • 7,647
  • 3
  • 41
  • 71
2
votes
0 answers

Remove arrow of "Open In..." menu on iOS

I'm positioning an "Open In..." menu in the center of the screen on my app. The problem is that iOS adds an arrow to the bottom of the rectangle. Is it possible to not have an arrow? If I use CGRectZero I don't have the arrow, but I can't position…
fnllc
  • 3,047
  • 4
  • 25
  • 42
1
2
3
10 11