Skip to content

Instantly share code, notes, and snippets.

@MACastro987
Created April 18, 2016 12:54
Show Gist options
  • Save MACastro987/3e85017c929a2ee82d13f8add0270bf6 to your computer and use it in GitHub Desktop.
Save MACastro987/3e85017c929a2ee82d13f8add0270bf6 to your computer and use it in GitHub Desktop.
- (void)viewWillLayoutSubviews
{
//scrollView.frame
statusIndicator.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
//Main Form
float fTop = 0.0; float fLeftIndent = 20.0;
float fFieldHeight = 60.0; float fCheckboxX = 275.0;
float fCheckboxSide = 35.0; float fLeftIndentRightColumn = 125.0;
float fTopIndentRightColumn = 10.0; float fTopIndent = 15.0;
_conditionsView.frame = CGRectMake(0.0, fTop, [[UIScreen mainScreen] bounds].size.width, fFieldHeight);
_conditionsLabel.frame = CGRectMake(fLeftIndent, fTopIndent, self.view.frame.size.width - 40, 40.0);
_stateView.frame = CGRectMake(0.0, (fTop + fFieldHeight), [[UIScreen mainScreen] bounds].size.width, fFieldHeight);
_stateImageView.frame = CGRectMake(fLeftIndent+4, fTopIndent+2, 76.0, 22.0);
stateField.frame = CGRectMake(fLeftIndentRightColumn, fTopIndentRightColumn, self.view.frame.size.width - (fLeftIndentRightColumn+10), 35.0);
_campusView.frame = CGRectMake(0.0, (fTop + fFieldHeight * 2), [[UIScreen mainScreen] bounds].size.width, fFieldHeight);
_campusImageView.frame = CGRectMake(fLeftIndent, fTopIndent, 96.0, 23.0);
campusField.frame = CGRectMake(fLeftIndentRightColumn, fTopIndentRightColumn, self.view.frame.size.width - (fLeftIndentRightColumn+10), 35.0);
_firstView.frame = CGRectMake(0.0, (fTop + fFieldHeight * 3), [[UIScreen mainScreen] bounds].size.width, fFieldHeight);
_firstImageView.frame = CGRectMake(fLeftIndent, fTopIndent, 83.0, 23.0);
firstField.frame = CGRectMake(fLeftIndentRightColumn+10, fTopIndentRightColumn, self.view.frame.size.width - (fLeftIndentRightColumn+10), 35.0);
[firstField setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter];
_lastView.frame = CGRectMake(0.0, (fTop + fFieldHeight * 4), [[UIScreen mainScreen] bounds].size.width, fFieldHeight);
_lastImageView.frame = CGRectMake(fLeftIndent, fTopIndent, 82.0, 23.0);
lastField.frame = CGRectMake(fLeftIndentRightColumn+10, fTopIndentRightColumn, self.view.frame.size.width - (fLeftIndentRightColumn+10), 35.0);
[lastField setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter];
_phoneView.frame = CGRectMake(0.0, (fTop + fFieldHeight * 5), [[UIScreen mainScreen] bounds].size.width, fFieldHeight);
_phoneImageView.frame = CGRectMake(fLeftIndent, fTopIndent, 96.0, 26.0);
phoneField.frame = CGRectMake(fLeftIndentRightColumn+10, fTopIndentRightColumn+3, self.view.frame.size.width - (fLeftIndentRightColumn+10), 35.0);
[phoneField setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter];
_emailView.frame = CGRectMake(0.0, (fTop + fFieldHeight * 6), [[UIScreen mainScreen] bounds].size.width, fFieldHeight);
_emailImageView.frame = CGRectMake(fLeftIndent, fTopIndent-5, 106, 39);
emailField.frame = CGRectMake(fLeftIndentRightColumn+10, fTopIndentRightColumn+3, self.view.frame.size.width - (fLeftIndentRightColumn+10), 35.0);
[emailField setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter];
_passwordView.frame = CGRectMake(0.0, (fTop + fFieldHeight * 7), [[UIScreen mainScreen] bounds].size.width, fFieldHeight);
_passwordImageView.frame = CGRectMake(fLeftIndent, fTopIndent-8, 128, 40);
passwordField.frame = CGRectMake(fLeftIndentRightColumn+25, fTopIndentRightColumn+3, self.view.frame.size.width - (fLeftIndentRightColumn+10), 35.0);
[passwordField setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter];
_instructionsView.frame = CGRectMake(0.0, (fTop + fFieldHeight * 8), [[UIScreen mainScreen] bounds].size.width, fFieldHeight);
_instructionsLabel.frame = CGRectMake(fLeftIndent, fTopIndent, self.view.frame.size.width - 40, 40.0);
_deafView.frame = CGRectMake(0.0, (fTop + fFieldHeight * 9), [[UIScreen mainScreen] bounds].size.width, fFieldHeight);
_deafLabel.frame = CGRectMake(fLeftIndent, fTopIndent, self.view.frame.size.width - 80, 35.0);
deafCheckbox.frame = CGRectMake(fCheckboxX,fTopIndent,fCheckboxSide,fCheckboxSide);
_blindView.frame = CGRectMake(0.0, (fTop + fFieldHeight * 10), [[UIScreen mainScreen] bounds].size.width, fFieldHeight);
_blindLabel.frame = CGRectMake(fLeftIndent, fTopIndent, self.view.frame.size.width - 80, 35.0);
blindCheckbox.frame = CGRectMake(fCheckboxX,fTopIndent,fCheckboxSide,fCheckboxSide);
_muteView.frame = CGRectMake(0.0, (fTop + fFieldHeight * 11), [[UIScreen mainScreen] bounds].size.width, fFieldHeight);
_muteLabel.frame = CGRectMake(fLeftIndent, fTopIndent, self.view.frame.size.width - 80, 35.0);
muteCheckbox.frame = CGRectMake(fCheckboxX,fTopIndent,fCheckboxSide,fCheckboxSide);
_handicappedView.frame = CGRectMake(0.0, (fTop + fFieldHeight * 12), [[UIScreen mainScreen] bounds].size.width, fFieldHeight);
_handicappedLabel.frame = CGRectMake(fLeftIndent, fTopIndent, self.view.frame.size.width - 80, 35.0);
handicappedCheckbox.frame = CGRectMake(fCheckboxX,fTopIndent,fCheckboxSide,fCheckboxSide);
_wheelchairView.frame = CGRectMake(0.0, (fTop + fFieldHeight * 13), [[UIScreen mainScreen] bounds].size.width, fFieldHeight);
_wheelchairLabel.frame = CGRectMake(fLeftIndent, fTopIndent, self.view.frame.size.width - 80, 35.0);
wheelchairCheckbox.frame = CGRectMake(fCheckboxX,fTopIndent,fCheckboxSide,fCheckboxSide);
_paraView.frame = CGRectMake(0.0, (fTop + fFieldHeight * 14), [[UIScreen mainScreen] bounds].size.width, fFieldHeight);
_paraLabel.frame = CGRectMake(fLeftIndent, fTopIndent, self.view.frame.size.width - 80, 35.0);
paraCheckbox.frame = CGRectMake(fCheckboxX,fTopIndent,fCheckboxSide,fCheckboxSide);
_quadriView.frame = CGRectMake(0.0, (fTop + fFieldHeight * 15), [[UIScreen mainScreen] bounds].size.width, fFieldHeight);
_quadriLabel.frame = CGRectMake(fLeftIndent, fTopIndent, self.view.frame.size.width - 80, 35.0);
quadriCheckbox.frame = CGRectMake(fCheckboxX,fTopIndent,fCheckboxSide,fCheckboxSide);
_noneView.frame = CGRectMake(0.0, (fTop + fFieldHeight * 16), [[UIScreen mainScreen] bounds].size.width, fFieldHeight);
_noneLabel.frame = CGRectMake(fLeftIndent, fTopIndent, self.view.frame.size.width - 80, 35.0);
noneCheckbox.frame = CGRectMake(fCheckboxX,fTopIndent,fCheckboxSide,fCheckboxSide);
contentView.frame = CGRectMake(0, 0, self.view.frame.size.width, _noneView.frame.origin.y+(_noneView.frame.size.height*1.4));
scrollView.contentSize = contentView.frame.size;
}
-(void)viewDidLoad
{
scrollView = [[UIScrollView alloc] init];
scrollView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height-44);
[scrollView setAlwaysBounceVertical:TRUE];
[scrollView setBackgroundColor:[UIColor whiteColor]];
[self.view addSubview:scrollView];
statusIndicator = [[NStatusIndicator alloc] init];
[statusIndicator setStatusText:NSLocalizedString(@"Loading campuses...", @"")];
[self.navigationController.view addSubview:statusIndicator];
[statusIndicator showStatusIndicator];
connection = [[NURLConnection alloc] initWithDelegate:self];
[self requestCampuses];
//register to know when the keyboard appears and automatically scroll so the text field the user is editing is always visible
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWasShown:)
name:UIKeyboardDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillBeHidden:)
name:UIKeyboardWillHideNotification object:nil];
[self.view setBackgroundColor:[UIColor whiteColor]];
[self setupNavigationBar];
[self setupMainForm];
[super viewDidLoad];
}
-(void)setupNavigationBar
{
[[self navigationController] setNavigationBarHidden:NO animated:NO];
//set back button with arrow
UIImage *buttonImage = [UIImage imageNamed:@"back_arrow_alpha.png"];
_backButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_backButton setImage:buttonImage forState:UIControlStateNormal];
float ratio = (self.navigationController.navigationBar.frame.size.height/buttonImage.size.height) * 0.7;
_backButton.frame = CGRectMake(0, 0, (buttonImage.size.width * ratio), (buttonImage.size.height * ratio));
[_backButton addTarget:self action:@selector(onBackButton) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *customBackButton = [[UIBarButtonItem alloc] initWithCustomView:_backButton];
//self.navigationItem.leftBarButtonItem = customBackButton;
[self.navigationItem setLeftBarButtonItem:customBackButton];
//set title
_labelTitle = [[UILabel alloc] initWithFrame:CGRectZero];
_labelTitle.backgroundColor = [UIColor clearColor];
_labelTitle.font = [UIFont systemFontOfSize:20.0];
_labelTitle.textAlignment = NSTextAlignmentCenter;
_labelTitle.textColor = [UIColor darkGrayColor];
//self.navigationItem.titleView = _labelTitle;
[self.navigationItem setTitleView:_labelTitle];
if (isEditMode)
_labelTitle.text = NSLocalizedString(@"Profile", @"");
else
_labelTitle.text = NSLocalizedString(@"Profile", @"");
[_labelTitle sizeToFit];
//setup "Done" button
_doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_doneButton setBackgroundColor:COLOR(20.0, 109.0, 230.0)];
[_doneButton addTarget:self action:@selector(done) forControlEvents:UIControlEventTouchUpInside];
_doneButton.frame = CGRectMake(0, 0, 75.0, self.navigationController.navigationBar.frame.size.height);
[_doneButton setTitle:NSLocalizedString(@"Done", @"") forState:UIControlStateNormal];
UIBarButtonItem *customDoneButton = [[UIBarButtonItem alloc] initWithCustomView:_doneButton];
//remove the right hand margin after the Next button
UIBarButtonItem *negativeSeparator = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
if (IOS7)
negativeSeparator.width = -16;
else
negativeSeparator.width = -5;
self.navigationItem.rightBarButtonItems = @[negativeSeparator, customDoneButton];
}
-(void)setupMainForm
{
//float fTop = 0.0;
if (IOS7)
self.edgesForExtendedLayout = UIRectEdgeNone;
contentView = [[UIView alloc] init];
contentView.clipsToBounds = YES;
//__"Tell us about yourself"
_conditionsView = [[UIView alloc] init];
_conditionsView.backgroundColor = COLOR(243.0, 243.0, 243.0);
addBorderToView(_conditionsView);
[contentView addSubview:_conditionsView];
_conditionsLabel = [[UILabel alloc] init];
_conditionsLabel.textColor = [UIColor darkGrayColor];
_conditionsLabel.backgroundColor = [UIColor clearColor];
_conditionsLabel.text = NSLocalizedString(@"Tell us about yourself", @"");
[contentView addSubview:_conditionsLabel];
//setup State
_stateView = [[UIView alloc] init];
addBorderToView(_stateView);
[contentView addSubview:_stateView];
_stateImageView = [[UIImageView alloc] init];
_stateImageView.image = [UIImage imageNamed:@"state.png"];
[_stateView addSubview:_stateImageView];
stateField = [[NTextPickerField alloc] init];
[stateField setDelegate:self];
[stateField setPlaceholder:NSLocalizedString(@"Select state", @"")];
[stateField setUid:@"state"];
[_stateView addSubview:stateField];
//setup Campus
_campusView = [[UIView alloc] init];
addBorderToView(_campusView);
[contentView addSubview:_campusView];
_campusImageView = [[UIImageView alloc] init];
_campusImageView.image = [UIImage imageNamed:@"school.png"];
[_campusView addSubview:_campusImageView];
campusField = [[NTextPickerField alloc] init];
[campusField setDelegate:self];
[campusField setPlaceholder:NSLocalizedString(@"Select school", @"")];
[campusField setUid:@"campus"];
[_campusView addSubview:campusField];
//setup First
_firstView = [[UIView alloc] init];
addBorderToView(_firstView);
[contentView addSubview:_firstView];
_firstImageView = [[UIImageView alloc] init];
_firstImageView.image = [UIImage imageNamed:@"first.png"];
[_firstView addSubview:_firstImageView];
firstField = [[UITextField alloc] init];
[firstField setPlaceholder:NSLocalizedString(@"John", @"")];
[firstField setDelegate:self];
[firstField setReturnKeyType:UIReturnKeyNext];
[firstField setFont:[UIFont systemFontOfSize:14]];
[firstField setTextColor:[UIColor darkGrayColor]];
[_firstView addSubview:firstField];
//setup Last;
_lastView = [[UIView alloc] init];
addBorderToView(_lastView);
[contentView addSubview:_lastView];
_lastImageView = [[UIImageView alloc] init];
_lastImageView.image = [UIImage imageNamed:@"last.png"];
[_lastView addSubview:_lastImageView];
lastField = [[UITextField alloc] init];
[lastField setPlaceholder:NSLocalizedString(@"Smith", @"")];
[lastField setDelegate:self];
[lastField setReturnKeyType:UIReturnKeyNext];
[lastField setFont:[UIFont systemFontOfSize:14]];
[lastField setTextColor:[UIColor darkGrayColor]];
[_lastView addSubview:lastField];
//setup Phone
_phoneView = [[UIView alloc] init];
addBorderToView(_phoneView);
[contentView addSubview:_phoneView];
_phoneImageView = [[UIImageView alloc] init];
_phoneImageView.image = [UIImage imageNamed:@"phone.png"];
[_phoneView addSubview:_phoneImageView];
phoneField = [[UITextField alloc] init];
[phoneField setPlaceholder:NSLocalizedString(@"1234567890", @"")];
[phoneField setDelegate:self];
[phoneField setKeyboardType:UIKeyboardTypeNumberPad];
[phoneField setReturnKeyType:UIReturnKeyDone];
[phoneField setFont:[UIFont systemFontOfSize:14]];
[phoneField setTextColor:[UIColor darkGrayColor]];
[_phoneView addSubview:phoneField];
//setup Email
_emailView = [[UIView alloc] init];
addBorderToView(_emailView);
[contentView addSubview:_emailView];
UIImage *emailImage = [UIImage imageNamed:@"email.png"];
_emailImageView = [[UIImageView alloc] init];
_emailImageView.image = emailImage;
[_emailView addSubview:_emailImageView];
emailField= [[UITextField alloc] init];
[emailField setPlaceholder:NSLocalizedString(@"myAddress@email.com", @"")];
[emailField setDelegate:self];
[emailField setReturnKeyType:UIReturnKeyDone];
[emailField setFont:[UIFont systemFontOfSize:14]];
[emailField setTextColor:[UIColor darkGrayColor]];
[_emailView addSubview:emailField];
//setup Password
_passwordView = [[UIView alloc] init];
addBorderToView(_passwordView);
[contentView addSubview:_passwordView];
_passwordImageView = [[UIImageView alloc] init];
_passwordImageView.image = [UIImage imageNamed:@"password.png"];
[_passwordView addSubview:_passwordImageView];
passwordField= [[UITextField alloc] init];
[passwordField setPlaceholder:NSLocalizedString(@"********", @"")];
passwordField.secureTextEntry = YES;
[passwordField setDelegate:self];
[passwordField setReturnKeyType:UIReturnKeyDone];
[passwordField setFont:[UIFont systemFontOfSize:14]];
[passwordField setTextColor:[UIColor darkGrayColor]];
[_passwordView addSubview:passwordField];
//__"Tell us about your health conditions"
_instructionsView = [[UIView alloc] init];
_instructionsView.backgroundColor = COLOR(243.0, 243.0, 243.0);
addBorderToView(_instructionsView);
[contentView addSubview:_instructionsView];
_instructionsLabel = [[UILabel alloc] init];
_instructionsLabel.textColor = [UIColor darkGrayColor];
_instructionsLabel.backgroundColor = [UIColor clearColor];
_instructionsLabel.text = NSLocalizedString(@"Tell us about your health conditions", @"");
[_instructionsView addSubview:_instructionsLabel];
_deafView = [[UIView alloc] init];
addBorderToView(_deafView);
[contentView addSubview:_deafView];
deafCheckbox = [[UIButton alloc] init];
[deafCheckbox setBackgroundImage:[UIImage imageNamed:@"checkbox_unchecked.png"] forState:UIControlStateNormal];
[deafCheckbox setBackgroundImage:[UIImage imageNamed:@"checkbox_checked.png"] forState:UIControlStateSelected];
deafCheckbox.adjustsImageWhenHighlighted=YES;
[deafCheckbox addTarget:self action:@selector(checkboxToggled:) forControlEvents:UIControlEventTouchUpInside];
[_deafView addSubview:deafCheckbox];
_deafLabel = [[UILabel alloc] init];
[_deafLabel setText:NSLocalizedString(@"Deaf or Hard of Hearing", @"")];
[_deafView addSubview:_deafLabel];
_blindView = [[UIView alloc] init];
addBorderToView(_blindView);
[contentView addSubview:_blindView];
blindCheckbox = [[UIButton alloc] init];
[blindCheckbox setBackgroundImage:[UIImage imageNamed:@"checkbox_unchecked.png"] forState:UIControlStateNormal];
[blindCheckbox setBackgroundImage:[UIImage imageNamed:@"checkbox_checked.png"] forState:UIControlStateSelected];
blindCheckbox.adjustsImageWhenHighlighted=YES;
[blindCheckbox addTarget:self action:@selector(checkboxToggled:) forControlEvents:UIControlEventTouchUpInside];
[_blindView addSubview:blindCheckbox];
_blindLabel = [[UILabel alloc] init];
[_blindLabel setText:NSLocalizedString(@"Blind or Visually Impaired", @"")];
[_blindView addSubview:_blindLabel];
//Mute
_muteView = [[UIView alloc] init];
addBorderToView(_muteView);
[contentView addSubview:_muteView];
muteCheckbox = [[UIButton alloc] init];
[muteCheckbox setBackgroundImage:[UIImage imageNamed:@"checkbox_unchecked.png"] forState:UIControlStateNormal];
[muteCheckbox setBackgroundImage:[UIImage imageNamed:@"checkbox_checked.png"] forState:UIControlStateSelected];
muteCheckbox.adjustsImageWhenHighlighted=YES;
[muteCheckbox addTarget:self action:@selector(checkboxToggled:) forControlEvents:UIControlEventTouchUpInside];
[_muteView addSubview:muteCheckbox];
_muteLabel = [[UILabel alloc] init];
[_muteLabel setText:NSLocalizedString(@"Mute", @"")];
[_muteView addSubview:_muteLabel];
//Handicapped
_handicappedView = [[UIView alloc] init];
addBorderToView(_handicappedView);
[contentView addSubview:_handicappedView];
handicappedCheckbox = [[UIButton alloc] init];
[handicappedCheckbox setBackgroundImage:[UIImage imageNamed:@"checkbox_unchecked.png"] forState:UIControlStateNormal];
[handicappedCheckbox setBackgroundImage:[UIImage imageNamed:@"checkbox_checked.png"] forState:UIControlStateSelected];
handicappedCheckbox.adjustsImageWhenHighlighted=YES;
[handicappedCheckbox addTarget:self action:@selector(checkboxToggled:) forControlEvents:UIControlEventTouchUpInside];
[_handicappedView addSubview:handicappedCheckbox];
_handicappedLabel = [[UILabel alloc] init];
[_handicappedLabel setText:NSLocalizedString(@"Handicapped", @"")];
[_handicappedView addSubview:_handicappedLabel];
//Power Wheelchair
_wheelchairView = [[UIView alloc] init];
addBorderToView(_wheelchairView);
[contentView addSubview:_wheelchairView];
wheelchairCheckbox = [[UIButton alloc] init];
[wheelchairCheckbox setBackgroundImage:[UIImage imageNamed:@"checkbox_unchecked.png"] forState:UIControlStateNormal];
[wheelchairCheckbox setBackgroundImage:[UIImage imageNamed:@"checkbox_checked.png"] forState:UIControlStateSelected];
wheelchairCheckbox.adjustsImageWhenHighlighted=YES;
[wheelchairCheckbox addTarget:self action:@selector(checkboxToggled:) forControlEvents:UIControlEventTouchUpInside];
[_wheelchairView addSubview:wheelchairCheckbox];
_wheelchairLabel = [[UILabel alloc] init];
[_wheelchairLabel setText:NSLocalizedString(@"Power Wheelchair", @"")];
[_wheelchairView addSubview:_wheelchairLabel];
//Paraplegic
_paraView = [[UIView alloc] init];
addBorderToView(_paraView);
[contentView addSubview:_paraView];
paraCheckbox = [[UIButton alloc] init];
[paraCheckbox setBackgroundImage:[UIImage imageNamed:@"checkbox_unchecked.png"] forState:UIControlStateNormal];
[paraCheckbox setBackgroundImage:[UIImage imageNamed:@"checkbox_checked.png"] forState:UIControlStateSelected];
paraCheckbox.adjustsImageWhenHighlighted=YES;
[paraCheckbox addTarget:self action:@selector(checkboxToggled:) forControlEvents:UIControlEventTouchUpInside];
[_paraView addSubview:paraCheckbox];
_paraLabel = [[UILabel alloc] init];
[_paraLabel setText:NSLocalizedString(@"Paraplegic", @"")];
[_paraView addSubview:_paraLabel];
//Quadriplegic
_quadriView = [[UIView alloc] init];
addBorderToView(_quadriView);
[contentView addSubview:_quadriView];
quadriCheckbox = [[UIButton alloc] init];
[quadriCheckbox setBackgroundImage:[UIImage imageNamed:@"checkbox_unchecked.png"] forState:UIControlStateNormal];
[quadriCheckbox setBackgroundImage:[UIImage imageNamed:@"checkbox_checked.png"] forState:UIControlStateSelected];
quadriCheckbox.adjustsImageWhenHighlighted=YES;
[quadriCheckbox addTarget:self action:@selector(checkboxToggled:) forControlEvents:UIControlEventTouchUpInside];
[_quadriView addSubview:quardiCheckbox];
_quadriLabel = [[UILabel alloc] init];
[_quadriLabel setText:NSLocalizedString(@"Quadriplegic", @"")];
[_quadriView addSubview:_quadriLabel];
//None of the Above
_noneView = [[UIView alloc] init];
addBorderToView(_noneView);
[contentView addSubview:_noneView];
noneCheckbox = [[UIButton alloc] init];
[noneCheckbox setBackgroundImage:[UIImage imageNamed:@"checkbox_unchecked.png"] forState:UIControlStateNormal];
[noneCheckbox setBackgroundImage:[UIImage imageNamed:@"checkbox_checked.png"] forState:UIControlStateSelected];
noneCheckbox.adjustsImageWhenHighlighted=YES;
[noneCheckbox addTarget:self action:@selector(checkboxToggled:) forControlEvents:UIControlEventTouchUpInside];
[_noneView addSubview:noneCheckbox];
_noneLabel = [[UILabel alloc] init];
[_noneLabel setText:NSLocalizedString(@"None of the Above", @"")];
[_noneView addSubview:_noneLabel];
//set all values from user defaults
NSArray *conditions = [DefaultUtils retrieveObjectFromUserDefaults:kConditionsKey];
if (conditions && [conditions count] > 0)
{
if ([conditions containsObject:kDeafKey])
[deafCheckbox setSelected:YES];
if ([conditions containsObject:kBlindKey])
[blindCheckbox setSelected:YES];
if ([conditions containsObject:kMuteKey])
[muteCheckbox setSelected:YES];
if ([conditions containsObject:kHandicappedKey])
[handicappedCheckbox setSelected:YES];
if ([conditions containsObject:kWheelchairKey])
[wheelchairCheckbox setSelected:YES];
if ([conditions containsObject:kParaplegicKey])
[paraCheckbox setSelected:YES];
if ([conditions containsObject:kQuadriplegicKey])
[quardiCheckbox setSelected:YES];
}
else
{
[noneCheckbox setSelected:YES];
}
[scrollView addSubview:contentView];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment