Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

iJustinCabral

macrumors member
Original poster
Jul 8, 2012
58
0
I know there is something like CGRect homeScreen = [[UIScreen mainScreen] bounds]; but I dont really understand what else to do with what is returned.

Can anyone out there give me some guidance?
 
Given these definitions -

Code:
struct CGPoint {
  CGFloat x;
  CGFloat y;
};
typedef struct CGPoint CGPoint;

/* Sizes. */

struct CGSize {
  CGFloat width;
  CGFloat height;
};
typedef struct CGSize CGSize;

/* Rectangles. */

struct CGRect {
  CGPoint origin;
  CGSize size;
};
typedef struct CGRect CGRect;

the statement -

Code:
CGRect homeScreen = [[UIScreen mainScreen] bounds];

gives the width and height of the screen as -

Code:
CGFloat width = homeScreen.size.width;
CGFloat height = homeScreen.size.height;
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.