I have posted the full code at the very bottom in case I am missing something elsewhere then what I put up here. Although this code opens the application fine, and when the button to initiate this code (the login action) is chosen the alert does appear, I have a few problems currently:
A) Choosing the "I agree" (case 0) still allows the alert to appear whenever the action is initiated (I am attempting to use the NSUserDefaults to prevent the alert from appearing after the I Agree button has been selected once)
B) All four buttons just dismiss the alert, opposed to [3 of the 4] calling the views (using modalviewcontroller:action) I am intending to use:
C) I would like to arrange the buttons in a box (in each corner) opposed to 4 horizontal buttons, which I know is possibly. I just can't recall/find the code to do something this. I think the code these questions can be answered from is here, but I have posted the full action below in case there is somewhere additional I need to edit. Thanks in advance
A) Choosing the "I agree" (case 0) still allows the alert to appear whenever the action is initiated (I am attempting to use the NSUserDefaults to prevent the alert from appearing after the I Agree button has been selected once)
B) All four buttons just dismiss the alert, opposed to [3 of the 4] calling the views (using modalviewcontroller:action) I am intending to use:
C) I would like to arrange the buttons in a box (in each corner) opposed to 4 horizontal buttons, which I know is possibly. I just can't recall/find the code to do something this. I think the code these questions can be answered from is here, but I have posted the full action below in case there is somewhere additional I need to edit. Thanks in advance
Code:
- (void)termsalert:(UIAlertView *)termsalert clickedButtonAtIndex:(NSInteger)buttonIndex {
switch(buttonIndex) {
case 0: {
[[NSUserDefaults standardUserDefaults] setValue:@"0" forKey:@"FirstAlert"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
break;
case 1: {
SubmittingTermsViewController *submitterms = [[SubmittingTermsViewController alloc] initWithNibName:nil bundle:nil];
[loginview presentModalViewController:submitterms animated:YES];
}
break;
case 2: {
ConditionsViewController *commissionsterms = [[ConditionsViewController alloc] initWithNibName:nil bundle:nil];
[loginview presentModalViewController:commissionsterms animated:YES];
}
break;
case 3: {
SitewidePoliciesViewController *privacyterms = [[SitewidePoliciesViewController alloc] initWithNibName:nil bundle:nil];
[loginview presentModalViewController:privacyterms animated:YES];
}
default:
break;
}
Code:
- (IBAction)login:(id)sender
{
UIAlertView *termsconditions = [[UIAlertView alloc]
initWithTitle:@"Terms & Conditions"
message: @"terms text"
delegate:self
cancelButtonTitle:@"I Agree"
otherButtonTitles:nil];
[termsconditions addButtonWithTitle:@"Submit Terms"];
[termsconditions addButtonWithTitle:@"Commission Terms"];
[termsconditions addButtonWithTitle:@"Privacy Terms"];
[termsconditions show];
[termsconditions release];
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
}
- (void)termsalert:(UIAlertView *)termsalert clickedButtonAtIndex:(NSInteger)buttonIndex {
switch(buttonIndex) {
case 0: {
[[NSUserDefaults standardUserDefaults] setValue:@"0" forKey:@"FirstAlert"];
[[NSUserDefaults standardUserDefaults] synchronize];
break;
}
case 1: {
SubmittingTermsViewController *submitterms = [[SubmittingTermsViewController alloc] initWithNibName:nil bundle:nil];
[loginview presentModalViewController:submitterms animated:YES];
}
break;
case 2: {
ConditionsViewController *commissionsterms = [[ConditionsViewController alloc] initWithNibName:nil bundle:nil];
[loginview presentModalViewController:commissionsterms animated:YES];
}
break;
case 3: {
SitewidePoliciesViewController *privacyterms = [[SitewidePoliciesViewController alloc] initWithNibName:nil bundle:nil];
[loginview presentModalViewController:privacyterms animated:YES];
}
default:
break;
}
// TODO: spawn a login thread
activityindicatorlogin.hidden = FALSE;
[activityindicatorlogin startAnimating];
buttonlogin.enabled = FALSE;
buttoninfo.enabled = FALSE;
buttonterms.enabled = FALSE;
buttonnewuser.enabled = FALSE;
buttonfullsite.enabled = FALSE;
buttonemailus.enabled = FALSE;
fieldpasswordlogin.enabled = FALSE;
fieldusernamelogin.enabled = FALSE;
}