Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 13    Views: 108

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

popup alert (like the javascript alert() function

I have some code: UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Test Message" message:@"This is a test" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; I would like this to popup when a specific screen is loaded (myScreenName). Can someone help me add this to xcode in the correct place?
 
theMonster
Code is Art
Profile
Posts: 435
Reg: Oct 18, 2011
US
8,050
like
10/21/12 11:39 PM (13 years ago)
Go to "myScreenName.m" go to - (void) viewDidLoad { .... some code here .... } And add it at the very end before the closing bracket '}'.
 
AussieRyan
Aspiring developer
Profile
Posts: 148
Reg: Mar 21, 2012
Margate, QLD Au...
1,480
like
10/22/12 01:14 AM (13 years ago)
That works, but I think I was a bit too generic. What I want to do is popup when SMS (text message) is used with a specific screen nickname.
 
theMonster
Code is Art
Profile
Posts: 435
Reg: Oct 18, 2011
US
8,050
like
10/22/12 01:18 AM (13 years ago)
Ah, that can be a bit more difficult.... Hmm... Not sure how to do that one actually. Sorry about that. Maybe someone smarter then me can figure it out. I'll message here again if I can come up with something. Also, that may be impossible, since you don't really "own" the text message view. So you can't really edit it as far as I know.
 
baywebnz
Aspiring developer
Profile
Posts: 92
Reg: Oct 25, 2010
location unknow...
920
like
10/22/12 03:36 AM (13 years ago)
Actually not too difficult: Just add: if[[BT_strings getStyleValueForScreen:self.screenData:@"itemNickname":@""]isEqualToString:@"Your screen nickname here"] { Your code } and add in your own screen nickname.
 
baywebnz
Aspiring developer
Profile
Posts: 92
Reg: Oct 25, 2010
location unknow...
920
like
10/22/12 05:11 AM (13 years ago)
Double post in error!
 
AussieRyan
Aspiring developer
Profile
Posts: 148
Reg: Mar 21, 2012
Margate, QLD Au...
1,480
like
10/22/12 01:07 PM (13 years ago)
where does this get added? Is it into the appdelegate.m file?
 
baywebnz
Aspiring developer
Profile
Posts: 92
Reg: Oct 25, 2010
location unknow...
920
like
10/22/12 01:55 PM (13 years ago)
Can you explain a bit more exactly what you are trying to achieve? Just re-read this: "What I want to do is popup when SMS (text message) is used with a specific screen nickname." Can you explain exactly how it should work for the user and what screen types (plugins) you are using? Also is it BT v2.0? Finally just noticed your a Queenslander! I just arrived on the Sunshine Coast 3months ago!
 
AussieRyan
Aspiring developer
Profile
Posts: 148
Reg: Mar 21, 2012
Margate, QLD Au...
1,480
like
10/22/12 02:57 PM (13 years ago)
1. BT v2.0 self-hosted 2. User selects menu option "SMS something" from <BTM: Menu Simple Advanced> 3. Screen <Send SMS (Text Message)> (BT screen nickname - submit results) loads 4. UIAlertView?? pops up with with some example text (eg enter code BA12345676 5 6 to submit results). 5. OK button to remove and proceed to send SMS Welcome to the Sunshine State. We lived on the Sunshine Coast hinterland (Maleny) for many years before moving to Brisbane. Love Buzztouch but slowly trying to learn xcode and how it interacts with BT.
 
AussieRyan
Aspiring developer
Profile
Posts: 148
Reg: Mar 21, 2012
Margate, QLD Au...
1,480
like
10/22/12 03:26 PM (13 years ago)
tried the code: if[[BT_strings getStyleValueForScreen:self.screenData:@"itemNickname":@""]isEqualToString:@"Your screen nickname here"] { ... etc and got an error "expected ( after if" so I changed code to: if([[BT_strings getStyleValueForScreen:self.screenData:@"itemNickname":@""]isEqualToString:@"Your screen nickname here"]) { ... etc the error goes away. Is this correct?
 
AussieRyan
Aspiring developer
Profile
Posts: 148
Reg: Mar 21, 2012
Margate, QLD Au...
1,480
like
10/22/12 03:31 PM (13 years ago)
duplicate post. Too many PC and too many screens!
 
baywebnz
Aspiring developer
Profile
Posts: 92
Reg: Oct 25, 2010
location unknow...
920
like
10/22/12 03:37 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]; }
 
AussieRyan
Aspiring developer
Profile
Posts: 148
Reg: Mar 21, 2012
Margate, QLD Au...
1,480
like
10/22/12 04:20 PM (13 years ago)
I was hoping to show I smart I had become. I actually found the same place to enter the code and got it working with the alert view. My obvious lack of knowledge meant I could not figure out the screen name issue and I got errors when I used the: if[[BT_strings getStyleValueForScreen:self.screenData:@"itemNickname":@""]isEqualToString:@"Your screen nickname here"] { ... etc I got multiple errors. Your codes works as advertised and I will include it in v1.2 of my BNR app. Thank you and I have actually learned something.
 
AussieRyan
Aspiring developer
Profile
Posts: 148
Reg: Mar 21, 2012
Margate, QLD Au...
1,480
like
10/23/12 05:02 PM (13 years ago)
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 another screen (screen nickname)?
 

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.