Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 06-05-2009, 01:29 PM   #1 (permalink)
New Member
 
Join Date: Jun 2009
Posts: 3
Arrow GoTo URL in UIActionSheet

I'm new to sdk development and am sure it's very simple, but can't seem to get it...what I would like to do is go to a specific URL after clicking on the "GoToURL1" button in a UIActionSheet.

This is the code I have so far:

----

UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:@"Title"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Button1"
otherButtonTitles:@"GoToURL1", @"GoToURL2", @"Open in Safari", nil];
[actionSheet showInView:self.view];
[actionSheet release];
}

---

Any help would be greatly appreciated!
newbieToo is offline   Reply With Quote
Old 06-05-2009, 08:21 PM   #2 (permalink)
ftm
FasterThanMonkeys.com
 
Join Date: Mar 2009
Location: Southern California
Posts: 523
Send a message via AIM to ftm
Default

Try something like this:

Code:
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
	if (buttonIndex == 0)
	{
		[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://yourUrlHere"]];
	}
}
__________________


Website: http://fasterthanmonkeys.com

iScore Baseball Scorekeeper Top baseball scorekeeping app for iPhone
Bug Squash Reached #1 kids game in 15+ countries including USA, now with OpenFeint
Jam Packed! Fun puzzle game for all ages
Jam Packed Christmas Holiday puzzle game!
iScore Basketball Scorekeeper Best basketball scorekeeping application
ftm is offline   Reply With Quote
Old 06-05-2009, 08:38 PM   #3 (permalink)
New Member
 
Join Date: Jun 2009
Posts: 3
Default

Quote:
Originally Posted by ftm View Post
Try something like this:

Code:
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
	if (buttonIndex == 0)
	{
		[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://yourUrlHere"]];
	}
}
Thanks for taking the time to answer! It does take me to the URL, but how can i have the URL open in the current app without opening up in Safari?

To elaborate on my app, it's a web browser that allows users to click on a button to be taken to a particular url. I would like them to stay in my app unless they choose to open it up in Safari.
newbieToo is offline   Reply With Quote
Old 06-05-2009, 08:51 PM   #4 (permalink)
ftm
FasterThanMonkeys.com
 
Join Date: Mar 2009
Location: Southern California
Posts: 523
Send a message via AIM to ftm
Default

If you want them to stay in your App, you need to put a UIWebView component in your app. If the UIWebView is visible when the button is pressed, just set the URL of the UIWebView to the URL of your page. If it is not visible, make it visible, then set the URL.
__________________


Website: http://fasterthanmonkeys.com

iScore Baseball Scorekeeper Top baseball scorekeeping app for iPhone
Bug Squash Reached #1 kids game in 15+ countries including USA, now with OpenFeint
Jam Packed! Fun puzzle game for all ages
Jam Packed Christmas Holiday puzzle game!
iScore Basketball Scorekeeper Best basketball scorekeeping application
ftm is offline   Reply With Quote
Old 06-08-2009, 09:33 AM   #5 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 24
Default

Quote:
Originally Posted by ftm View Post
If you want them to stay in your App, you need to put a UIWebView component in your app. If the UIWebView is visible when the button is pressed, just set the URL of the UIWebView to the URL of your page. If it is not visible, make it visible, then set the URL.
If i use openURL for sending SMS and mails then it is terminating my application, how to reopen my application, if anyone knows how to do it please help me out.

Thank you,

Lakshmikanth.
S.LakshmiKanth Reddy is offline   Reply With Quote
Old 06-08-2009, 01:16 PM   #6 (permalink)
ftm
FasterThanMonkeys.com
 
Join Date: Mar 2009
Location: Southern California
Posts: 523
Send a message via AIM to ftm
Default

Using openURL will always exit the App and take you to Safari. There is not a way to automatically get back in to your application.

If you want the user to view a web page and return to your App, you will have use a UIWebView component in your app instead. This will allow viewing of web pages without leaving the application.
__________________


Website: http://fasterthanmonkeys.com

iScore Baseball Scorekeeper Top baseball scorekeeping app for iPhone
Bug Squash Reached #1 kids game in 15+ countries including USA, now with OpenFeint
Jam Packed! Fun puzzle game for all ages
Jam Packed Christmas Holiday puzzle game!
iScore Basketball Scorekeeper Best basketball scorekeeping application
ftm is offline   Reply With Quote
Old 06-08-2009, 03:06 PM   #7 (permalink)
New Member
 
Join Date: Jun 2009
Posts: 3
Default

Quote:
Originally Posted by ftm View Post
Using openURL will always exit the App and take you to Safari. There is not a way to automatically get back in to your application.

If you want the user to view a web page and return to your App, you will have use a UIWebView component in your app instead. This will allow viewing of web pages without leaving the application.
If you open a new UIWebView (to keep the user in the app), can you also keep the previous view to quickly move back to the original webpage without reloading, similar to how you can open multiple web sites in Safari?
newbieToo is offline   Reply With Quote
Old 06-08-2009, 07:08 PM   #8 (permalink)
jsd
at this moment
 
Join Date: Mar 2009
Location: San Francisco, CA
Posts: 900
Default

Sure, you can keep as many UIWebViews around as you want... just be sure to handle the low memory warning by tossing the ones that aren't in use at the moment.
jsd is offline   Reply With Quote
Old 06-10-2009, 01:58 PM   #9 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 24
Default

Quote:
Originally Posted by ftm View Post
Using openURL will always exit the App and take you to Safari. There is not a way to automatically get back in to your application.

If you want the user to view a web page and return to your App, you will have use a UIWebView component in your app instead. This will allow viewing of web pages without leaving the application.
Yes, i agree with you, we can do that only if we are willing to open a web page, but here i am calling the sms service like "sms:17737452345", this will redirect to the sms application.
S.LakshmiKanth Reddy is offline   Reply With Quote
Old 01-07-2010, 05:20 PM   #10 (permalink)
Registered Member
 
Join Date: Dec 2009
Location: Salt Lake City, UT
Age: 28
Posts: 7
Default

Quote:
Originally Posted by S.LakshmiKanth Reddy View Post
Yes, i agree with you, we can do that only if we are willing to open a web page, but here i am calling the sms service like "sms:17737452345", this will redirect to the sms application.
What about on a button press if I want to call a script on a web site but I do not want to display the page I am calling and I do not want to leave the app.

Example...

I want a text entry field that you can enter information into then hit submit. with out leaving the app i need that text to be placed in the database Via a PHP script task But after they hit submit the user should not see a thing. except maybe a success message from the server

...

I want to call urls with out opening them How do i do that?

-TTBAKIATWOAM
TTBAKIATWOAM is offline   Reply With Quote
Old 01-07-2010, 06:20 PM   #11 (permalink)
jsd
at this moment
 
Join Date: Mar 2009
Location: San Francisco, CA
Posts: 900
Default

Quote:
Originally Posted by TTBAKIATWOAM View Post
What about on a button press if I want to call a script on a web site but I do not want to display the page I am calling and I do not want to leave the app.

Example...

I want a text entry field that you can enter information into then hit submit. with out leaving the app i need that text to be placed in the database Via a PHP script task But after they hit submit the user should not see a thing. except maybe a success message from the server

...

I want to call urls with out opening them How do i do that?

-TTBAKIATWOAM
You can use NSURLRequest to talk to a web server without leaving your app or displaying any UI elements. Personally I prefer the third-party ASIHTTPRequest library, as it handles a lot of the boring detail work for you. ASIHTTPRequest Documentation - All-Seeing Interactive
jsd is offline   Reply With Quote
Reply

Bookmarks

Tags
actionsheet, button, buttonclicked, url

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 350
21 members and 329 guests
ADY, Dani77, Duncan C, e2applets, Herbie, JasonR, keeshux, linkmx, mer10, Monstertaco, piesia, prchn4christ, Promo Dispenser, Robiwan, sebasx, sly24, Touchmint, twerner, zulfishah
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,880
Threads: 89,228
Posts: 380,760
Top Poster: BrianSlick (7,129)
Welcome to our newest member, @sandris
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:34 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0