how to move moretab in iphone - iphone

in my applicaton,i have one directions tab in moretab.In directions tab, i displays the safari view through coding like this
NSString* url = #"http://maps.google.com/maps?saddr=33.68325,-117.834073&daddr=33.67425,-117.835073&dirflg=w";//[NSString stringWithFormat: #"http://maps.google.com/maps?q=%#",#"1101+E+Fletcher+Ave+Tampa+FL+33612"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
when click the directions tab it shows the safari browser.But my problem is after open the safari view, iam not able to move the more tab again. now what i want be done is ,when closing this safari view and reopen my application it directly shows the more tab not directions tab.How to do this.

Often times directing the user to Safari can be very confusing and some users don't understand how to come back. Consider using UIWebView instead for this since it stays inside your app and also provides you with the control that you are talking about now.
If you absolutely have to direct the user to safari I would take a look at this post that talk about how to catch the events of a user leaving your app and different states for that.

Related

how to open the app store when clicking button

enter image description hereI want to open the app store when I click a certain button but, I have looked everywhere, and the code I have tried takes me to a safari link or doesn't do anything at all. can anyone help me? what i want it to achieve is that i hit the button and it opens up the app store with my specified app
UPDATE: i tried the method below and it opened oped up safari saying it could open the page
Zenprogrammer79 if your using the iOS simulator the link won't work because there is no App Store on the simulator but it should work on a real iOS device
zenProgrammer79 if you have a link to another app in the App Store, you can put this code in the section of where your button gets pressed (the IBAction) (objective-c)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"link to the application link looks like https://itunes.apple.com/au/app/sugar-calculator/id1000071935?mt=8"]];
if you are using swift i believe this will work
UIApplication.sharedApplication().openURL(NSURL(string: "https://itunes.apple.com/au/app/sugar-calculator/id1000071935?mt=8")!)
if this doesn't work then your link to the app is probably wrong.

how to open a website using SAFARI in fullscreen mode for iPad

I am having a requirement where a website ( url is hardcoded )would be getting open in full-screen mode
i.e. No address bar or No menu-bar buttons of SAFARI should be displayed in my application.
I am using following lines of code for the opening url in SAFARI browser.
NSURL *url=[[NSURL alloc]initWithString:#"http//www.google.com"];
[[UIApplication sharedApplication] openURL:url];
what properties shall I set for UIApplication so that I will get the SAFARI browser in full-screen mode in my app?
You can't do this from the Application, it is up to the website to try and enforce this. In order to achieve what you're after, I believe you need to make the website pretend to be a web-app.
Apple have documentation on how to customize Safari for your website, see http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/configuringwebapplications/configuringwebapplications.html, specifically "Hiding Safari User Interface Components"

iPhone SDK - Add a "Add to Home Screen" button in a UIWebView

I have a native iPhone app, which has a UIWebView component to it. I am trying to see if I can replicate the "Add to Home Screen" button that is present in the tab bar options in Safari.
Is this possible inside a UIWebView within a native app?
Thanks!
Brett
[I presume your question is about replicating the action associated with add to home screen, rather than replicating the appearance of the button itself (which being pedantic is what you actually wrote).]
As others have said this isn't possible.
What you could do is programatically launch Safari from within your app and give it the URL of a page to load which is your page.
When your page is loaded it has some sort of animation and shows the user where the add to home screen button is and tell them to press it after clicking a link which is displayed in your web page. When the users click on the link it takes them to whatever page it is that you would like saved to the desktop, and you hope they follow your instructions.
If you register your app to handle a proprietary url scheme the users can get back to your app from within Safari by clicking on a link using your app's url scheme.
The web pages that you seed Safari with must however be remote pages, you cannot give Safari a page in your app's bundle or that your app has downloaded as Safari cannot read pages from your app's sandbox.
The short answer is no, you can't. Apple does not let you.
Here's a similar question which may help you come up with other possibilities:
Javascript for "Add to Home Screen" on iPhone?
If I had to think of a work around off the top of my head, you could create an javascript pop-up which instructs them how to. It could say something like tap this button to go to mobile safari then tap action -> add to home screen.
Execute the Javascript with UIWebView's method:
- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script
Hope this helps.
You can use UIActivityViewController with your url as the activity items
NSArray *activityItems = #[title, url];
And then you can exclude the activities that you don't want. I think it´s the only way for now.

Objective-C iPhone - Open Multiple URLs in Safari

I know how to open an URL from app in Safari using [[UIApplication sharedApplication] openURL:url];. This is great, but what I need to do is that I have multiple URLs and I want to start Safari with more tabs opened with those URLs.
I tried calling openURL multiple times but it just opens Safari once and other urls are ignored.
Is there any way of opening multiple tabs in Safari from my app?
Thanks.
When you call UIApplication openURL:, your application will be put in the background and will no longer be allowed to perform these operations. I do not think that opening multiple tabs is something that iOS Safari supports. Tabs are probably implemented in a more memory-efficient way (i.e. loading only the tab you see, saving a picture of the others until you switch to them). It would help knowing why you want to open multiple tabs.
Some suggestions:
Open a link to a "launcher" page, which takes you to the page you want
Use UIWebView and implement the tabs yourself
Create a menu of some sorts in your app, opening only one page at once

Launch Safari from iPhone App

I know that i can use the following code to launch my own url, but i want the user to continue their workflow after using my bookmarklet so therefore don't want to open a new tab and have them re-load the url i put into the url variable?
NSURL url* = [NSURL URLWithString:#"http://google.com"];
[[UIApplication sharedApplication] openUrl:""];
Can this be done?
There is no way to open Safari without actually quitting your app and opening Safari. Or to somehow automatically return the user to your app from Safari once the URL you opened loads.
Or am I misunderstanding the question?
Actually, you can delegate a URL handler to your app. A smart example is shown here:
http://www.mobileorchard.com/lite-to-paid-iphone-application-data-migrations-with-custom-url-handlers/
The scenario is:
- register URL handler
- open Safari as normal
- get Safari to use your custom URL handler that should open your app (eg: myapp://)
Have a look at the way Flickr iPhone app does the authentication.
Can you use 'about:blank' as the url? That should just open Safari with a blank page. I assume this would be similar to tapping the 'number' button in the bottom right then selecting 'new page'.