Skip to content

Instantly share code, notes, and snippets.

@Alos
Created May 11, 2013 03:00
Show Gist options
  • Save Alos/5558737 to your computer and use it in GitHub Desktop.
Save Alos/5558737 to your computer and use it in GitHub Desktop.
var sexLabel = [[CPTextField alloc] initWithFrame: CGRectMake(40, 430, 100, 30)];
[sexLabel setStringValue:"Sex:"];
[sexLabel setTextColor: [CPColor colorWithHexString:"FFFFFF"]];
[sexLabel sizeToFit];
[self addSubview:sexLabel];
maleRadioButton = [CPRadio radioWithTitle: "Male"];
femaleRadioButton = [CPRadio radioWithTitle: "Female"];
otherRadioButton = [CPRadio radioWithTitle: "Other"];
radioGroup = [maleRadioButton radioGroup];
[femaleRadioButton setRadioGroup:radioGroup];
[otherRadioButton setRadioGroup:radioGroup];
[maleRadioButton setFrameOrigin:CGPointMake(100, 430 )];
[femaleRadioButton setFrameOrigin:CGPointMake(CGRectGetMaxX([maleRadioButton frame]) + 8, CGRectGetMinY([maleRadioButton frame]))];
[otherRadioButton setFrameOrigin:CGPointMake(CGRectGetMaxX([femaleRadioButton frame]) + 8, CGRectGetMinY([femaleRadioButton frame]))];
[self addSubview:maleRadioButton];
[self addSubview:femaleRadioButton];
[self addSubview:otherRadioButton];
@aparajita
Copy link

I'll assume self is a CPView subclass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment