Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does this mean? initWithFrame:CGRectZero]

Tags:

iphone

I created switch in cellForRowAtIndexPath like this.

UISwitch *switchView = [[UISwitch alloc] initWithFrame:CGRectZero];

CGRectZero is equivalent to CGRectMake(0,0,0,0). But, switch is seen in normal size. I didn't specified actuall size. Please explain to me how above code works.

like image 599
user698200 Avatar asked Aug 27 '11 15:08

user698200


1 Answers

UISwitch is not customizable, this also applies to the size.

UISwitch overrides initWithFrame: and enforces a size appropriate for the control. The size components of the given rectangle are ignored.

like image 165
Felix Avatar answered Sep 29 '22 01:09

Felix