I have a tab bar iphone app. The second tab has formatted text with images so I inserted it as html file to uiwebview. I would like insert links on some parts of the text and on some images in this html file to the first tab view with different parameters. How can I do that?
Create an instance of UIWebViewDelegate,and implement the method:
"webView:shouldStartLoadWithRequest:navigationType:
Sent before a web view begins loading content."
...and implement your code to do things on the first tab when the user clicks any of the "special" links. Also, make sure to return "false" when the link clicked is one of those links, to stop the webview from loading them in the second tab.
Related
How does apple feel about blocking tabs from being clickable until for example when the user has clicked on a uitableview row on another tab?
Sometimes you may not want the content of another tab being accessible until a certain criteria has been met.
Example:
Playlist Search Played Settings
In this case I don't want the user to click on Search tab before having chosen a playlist in the Playlist tab.
Is this enough for the app to not be approved on the appstore?
You should do something similar to the music app, show an empty tab with an explanation as to why this tab is empty. Like this:
You could change the available view controllers in the UITabBarController. When the user selects a certain row (as you have suggested), call
– (void)setViewControllers:(NSArray *)controllers
animated:(BOOL)animated;
So as you have suggested, don't add the search view controller until after they have selected a playlist.
I have a UIWebView controller that loads a web page and I would like to add some kind of a bar at the top of the page with refresh and close buttons.
The bar should hide when the page loaded and should show again if the user taps the top part of the page.
Does anyone know how to approach it? Is there any simple way to do that?
UPDATE:
I think I wasn't clear enough with the question, so here are some clarifications:
1. The applications is a standard application that one of the flows opens UIWebView that loads a web page
2. What I'm looking for is a bar that will slide down on top of the web page (loaded in UIWebView) and should help the user overcome a scenario where the web page is not loaded for some reason
3. The bar should hold the back (just close the UIWebView) and refresh (reload UIWebView) operations.
Hope it helped.
Thanks,
Shimix
I'm working on something like this right now and so far, here's what I've come up with. Some of this may be obvious, but important:
Your address bar should be the left navigationItem.
The search bar is the rign navigationItem.
You should animate a cancel button in/out when beginning/ending editing in the URL box.
Safari Mobile uses the Prompt property of the navigationBar to display webpage titles.
To animate the widths of the search/URL bars, use UIView animation when the bar is selected.
It's pretty simple to add a UIToolbar above the webview with UIBarButtonItems that call the webview's refresh, back, and forward methods. You can also add the webviewdelegate methods to your view controller to detect when the page has finished loading and hide/show the toolbar that way.
If you want the refresh and navigation controls to be displayed as part of the html content of the webview itself, that's a littler tricker, but not impossible. You can use the webview's shouldLoadRequest delegate method to detect that those buttons have been tapped, and then take the appropriate action within your viewcontroller. Hiding and showing the nav bar would have to be handled in javascript.
Unless I'm missing a library/project doing this, I don't think there is a simple way to do this.
I have already coded something similar to Safari mobile address bar, and from memory, it involved using private apis and/or playing with the "not so private but use at your own risks" UIWebView subviews hierarchy...
i have searched this site back and forth withoutfinding a clear answer for what i want.
i have a detail view which is presented after pressing a cell in a table view, this has a uitextview which displays the content of the cell. in most cases this text will have a url link, which when pressed opens the page in safari.
what i want to do is open the link in a UIWebView which i hae on another tab within my app, is it possible to push this link onto my uiwebview insteadof opening safari?
i am fairly new to coding, all self taught. so if you could explain with some detail itwill be appreciated.
Many thanks in advance
mike
See iPhone SDK - opening links in a UITextView in a web view
My app is a Navigation based application. The main menu contains the list view items. if I clicks one of them, it goes to next view which in this case take me to UIwebview embedded web site. Everything is looking great. I can view the content of web page, the navigation control back button which takes to the main menu if I press it. However, I'm having issue when I try to go back to main menu if i visit that subview the second time. It loads the content of UIwebview web page, but the navigation button is gone and won't let me go back to main menu. This problem only appears on latest iOS 4.2 version. Otherwise it works great on 3.1 to 4.1. I would appreciate any hints or inputs.
Note this seems not working for subview using UIWebview embedded web content. I don't have any issue with other subviews
Can you show us the code ? Did you try this: self.navigationItem.hidesBackButton = NO; in viewDidLoad method where you are adding UIWebView to your view..
XCode: "This template provides a starting point for an application that uses a single view. It provides a view controller to manage the view, and a nib file that contains the view."
What does that even mean? (ie what does Single view actually mean)
1) This means that your application will only have a single view screen that is active
2) This means that your application will be able to have as many screens as you like using a single view controller.
Ok now what if your application has multiple screens? not a single view screen, is still suitable under a view based application template?
Example
Screen1(main): on this screen you have 3 buttons, "Open Form1", "Open Form2", "Open Form3"
When the button is clicked it opens up the associated screen,
Press the "Open Form1" button opens up "Form1" screen2
Press the "Open Form2" button opens up "Form2" screen3
Press the "Open Form3" button opens up "Form3" screen4
When the user completes the form and submits it, a thank you screen is displayed
therefore in this example there would be a total of 5 screens.
Each form screen contains is different, textfield inputs, and information, is this considered as a view based application?
View-based app is just a template to say that your app will be view-based. That means that you can have any number of views you want, as this template comes with a view controller (that, as the name says, can be used to control the views... show/hide them with animation, for example).
The template starts with ONE VIEW that is added to the app view controller. You can add any number of views to that controller.
So, yes to your questions. You can use this to create the app you mention, where any of the "screens" you mention would be a view, for example and you can show each one using, for instance, the app view controller to animate each view showing or hiding.
That means the template will create one view and corresponding view controller along with app delegate, main window. That will also do the necessary things to add this view to main windows, and load when app runs. This is just a template. Then you can crate any number of views and view controllers as you want.
This means that the template you are starting the project with provides a single ViewController, and associated XIB for the View. As the first answer says you could use this template to build the application mentioned.
HOWEVER you may wish to think about how the user is going to interact with your app. Will you allow stepping back and forwards through the screens, in which case you may want to consider the Navigation Based app where you push/pop screens onto a stack to allow easy movement between then.
You might also have a concept of allowing the user to jump at will between each of the screen pages in which case you might want to implement a TabBar application.
Or you could just implement it all yourself. At the end of the day it will be your application design, and the template is only a starting point to get you going. I would suggest that if you are starting out with iOS development however to go with 1 ViewController matched a XIB for each screen you wish to implement to keep things simple.