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
1
vote
1 answer

Xcode: change row for looping buttons

using the code down below to loop out 200 buttons and wnat the row go down a notch when the row is full. Im guessing there must be a better way because my way dosent work. When the second and third row begins i onl have one button. No errors just…
pRob3
  • 371
  • 4
  • 7
1
vote
3 answers

setFrame - I need some clarification for this

I have a code for programmatic creation of buttons, and here it is UIImage *aroundImage = [UIImage imageNamed:@"locBar.png"]; UIImage *aroundImageDown = [UIImage imageNamed:@"locBarColor.png"]; UIButton *aroundButton = [UIButton…
Spire
  • 1,055
  • 2
  • 17
  • 47
1
vote
0 answers

change PageControl height from UIPageViewControllerDataSource

I have a PageViewController set up and everything is working as it should. Currently I'm working on the GUI appearances, and running into some problems with the Page Indicator (UIPageControl). I have set up the datasource of the PageViewController…
Paul Heuts
  • 11
  • 1
1
vote
1 answer

UIImageView won't change size

I am trying to alter the width and height of an UIImageView object but for some reason I can't. This is the code I used: -(void)setMenuImages { self.menuImageButton.image=[UIImage imageNamed:@"myimage.jpg"]; …
Student
  • 418
  • 1
  • 4
  • 17
1
vote
2 answers

iOS Swift Scrollview Set Frame Position Programmatically

I am have scrollview in my app. By default y position of my scrollview is 80. In some locations I need to move y position of my scrollview to 0. Here is the code @IBOutlet weak var ScrollView: UIScrollView! override func viewDidLoad() { …
Kavin Kumar Arumugam
  • 1,792
  • 3
  • 28
  • 47
1
vote
1 answer

How to get the exact point of objects in swift?

I'm using a UIProgressView and want to stick a image subview to the progress % as in the image below: I want to get the co-ordinate of the progress tint and red subview as in the figure to "stick" with the progress tint, whatever the progress will…
Aashish
  • 2,532
  • 2
  • 23
  • 28
1
vote
1 answer

tableHeaderView doesn't properly resize

I am using a UITableView with a custom tableHeaderView In my viewDidLayoutSubviews I am using properly working code like this: let bounds = UIScreen.mainScreen().bounds imageSliderVC.view.frame = CGRectMake(0, 0, bounds.width, bounds.width) …
JVS
  • 2,592
  • 3
  • 19
  • 31
1
vote
2 answers

Changing UISlider x and y position

I have viewController with slider inside and I need to change the position of slider programmatically. I am using following code: mySliderOutlet.frame = CGRectMake(100, 250, mySliderOutlet.frame.size.width,…
otter
  • 93
  • 2
  • 8
1
vote
1 answer

Objective C setFrame not working for UIView

I am using setFrame to change the X position of my view. I have the views positioned outside of the UIViewController and when I click any of the buttons, it brings in the UIView depending on which button is pressed. I am not sure what I am doing…
Curtis Boylan
  • 827
  • 1
  • 7
  • 23
1
vote
1 answer

Swift: Why CGImageCreateWithImageInRect() creates a rectangle 1 more pix larger?

When I use CGImageCreateWithImageInRect() to create an CGImage it creates a rectangle 1 px taller and 1 px wider than the rectangle I passed in. Why is this happening? let rect: CGRect = CGRectMake(CGFloat(124.583333333333),…
AarioAi
  • 563
  • 1
  • 5
  • 18
1
vote
0 answers

How to add Instagram like animation that minimizes the title "Instagram" on scroll down in Swift 2?

I am trying to add the Instagram like animation on my app that minimizes the title "Instagram" and moves the display to the entire page. In my app, i have two UILabels - chapterNameNumberLabel and chapterNameLabels and a UITextView. On scrolling in…
Kavisha
  • 155
  • 1
  • 10
1
vote
1 answer

IOS UIImageView in cell has wrong size

I'm trying to replace an Image from an URL if it exists. The problem seems to be that I can't set the size of my UIImageView. My Code looks like this: UIImageView *partnerIcon = (UIImageView*)[cell viewWithTag:0]; NSURL *imageUrl = [NSURL…
fsulser
  • 853
  • 2
  • 10
  • 34
1
vote
1 answer

Centering an Oval using CGRectMake Swift

I am having trouble trying to center my oval programmatically currently I have this code func setupLayers(){ let oval = CAShapeLayer() oval.frame = CGRectMake(137.5, 283.5, 100, 100) oval.path = ovalPath().CGPath; …
Harish
  • 1,374
  • 17
  • 39
1
vote
1 answer

memory game - define different amount of cards for each level

i want to make a simple memory matching game. this is my following situation: i have a levelselectionviewcontroller and a gameviewcontroller. in my levelselectionviewcontroller i have 10 buttons (10 levels). i want, that when i click on level 1, my…
Sausagesalad
  • 91
  • 10
1
vote
1 answer

How to align view and subview center Objective-C

I have these two views that i would like to align to be centered. self.loadingView = [[UIView alloc] initWithFrame:CGRectMake(75, 155, 120, 120)]; self.loadingView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0…
user2854773
1 2
3
10 11