Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 3    Views: 80

AussieRyan
Aspiring developer
Profile
Posts: 148
Reg: Mar 21, 2012
Margate, QLD Au...
1,480
10/24/12 03:22 PM (13 years ago)

UIAlertview - Part 2

I have the code from: https://www.buzztouch.com/forum/thread.php?tid=17F7BC72353168523897FEF&sortColumn=FT.id&sortUpDown=DESC&currentPage=1 working great Next step to advance my knowledge, hopefully? Is there a way to add another button to the UIAlertView (otherButtonTitles:@"Option 1", nil];) that will dismiss the UIAlertView and load a new screen (screen nickname)?
 
XboxMods
buzztouch Evangelist
Profile
Posts: 718
Reg: Oct 28, 2011
location unknow...
12,080
like
10/24/12 04:17 PM (13 years ago)
What code are you using?
 
AussieRyan
Aspiring developer
Profile
Posts: 148
Reg: Mar 21, 2012
Margate, QLD Au...
1,480
like
10/24/12 04:29 PM (13 years ago)
Try this: In file BT_viewControllerManager.m Find the code: //send SMS or share SMS if([[theScreenData itemType] isEqualToString:@"BT_screen_sms"] || [[theScreenData itemType] isEqualToString:@"BT_sendSms"] || [[theScreenData itemType] isEqualToString:@"BT_sendSMS"] || [[theScreenData itemType] isEqualToString:@"BT_shareSms"] || [[theScreenData itemType] isEqualToString:@"BT_shareSMS"] || [[theScreenData itemType] isEqualToString:@"BT_screen_shareSms"]){ if([appDelegate.rootApp.rootDevice canSendSMS]){ and put this immediately after it(change the nickname if needed): if([[theScreenData itemNickname] isEqualToString:@"submit results"]){ UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Test Message" message:@"This is a test" delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", "OK") otherButtonTitles:nil]; [alertView show]; [alertView release]; }
 
theMonster
Code is Art
Profile
Posts: 435
Reg: Oct 18, 2011
US
8,050
like
10/24/12 08:59 PM (13 years ago)
Yes, very simple Change your UIAlertView Object to: UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Test Message" message:@"" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Button 1", @"Button 2", nil]; [alert show]; [alert release]; In your BT_viewControllerManager.h file, go to the @implementation line, and Put <UIAlertViewDelegate> at the end of that line. Add this method to your BT_viewControllerManager.m file: - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { if (buttonIndex == 0) { // Button Canceled } else if (buttonIndex == 1) { // Button 1 Pushed } else if (buttonIndex == 2) { // button 2 pushed } } As for changing to a different scene, you'll need to do something like this: AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; BT_item *screenObjectToLoad = [appDelegate.rootApp getScreenDataByNickname:productScreenNickname]; [BT_viewControllerManager handleTapToLoadScreen:self.screenData :nil :screenObjectToLoad];
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.