Force JQuery Mobile page inside UIWebView to call webViewDidStartLoad - iphone

In my iPhone app I've got the following hierarchy:
UITabBarController ->
UINavigationController ->
UIViewController<UIWebViewDelegate> ->
UIWebView
(jQuery Mobile-page)
In the UIViewControllers navigationItem, I've added a button whose action selector is the UIWebViews goBack-function. When the button is pressed, everything goes according to plan - the UIWebView navigates backwards (including the fancy jQuery Mobile-transitions).
The problem is that, since jQuery Mobile uses some kind of "internal linking" when navigating to different pages (adding #the/newPage/url.html to the URL), the UIWebViewDelegate function webViewDidStartLoad is never being called when pages within the same jQuery Mobile-driven site are loaded.
Anyone with suggestions on how to make the jQuery Mobile-page fire off the delegate function? Possibly with maintained transitions. If this isn't possible, do anyone have suggestions about any other "web app framework" that is capable of this (delegate calls + transitions)?
Thanks!
UPDATE
Maybe my question is almost the same as this one here on stackoverflow, but I at least think that mine is a bit more specific. If you disagree, leave a comment :)

Related

UIWebView to View Controller?

I was wondering if anyone knew if this was possible?
I have a uiwebview as the first view controller which is showing a basic html page I made with the Facebook login screen. Can you login (in the uiwebview) and once it authorises you (in the uiwebview) it closes and launches the second view controller?
Does anyone know of a good example or tutorial for this?
If not can someone point me in the direction of a good FacebookSDK example or tutorial in Storyboard not XIB?
Thanks!
You should be using the FBLoginView and FBSession classes of the Facebook SDK to log in. You can just use the delegate callbacks from those to drive your next view controller.
I can't think of a reason you would want to bring up the facebook login page in a UIWebView , rather than doing the above. If for some reason you actually need to use a UIWebView , the webViewDidFinishLoad: method of UIWebViewDelegate might provide you with the hook you need.
Download the Facebook sdk from github and check the SessionLoginSample in samples. I think it has everything you need

Return to mainview from webView deployed using storyboard

I created a new project "Single View Application" and designed the mainView with Storyboard. My main view contains a UIButton that opens the camera, the camera scans barcode and automatically goes to a website. Now I created a webView programmatically so that website can open and also created a UIButton inside the webView. Now I want that UIButton to act as home botton and return to mainview. I am unable to do that, please help.
ViewController.m code: http://cl.ly/FKj8
My storyboard looks like:
You really should look into the View Controller Programming Guide -- by switching around the contents of a single view controller, you're making a lot of extra work for yourself with little benefit. By using multiple view controllers when you want to have different "screens" in your app, you can take advantage of storyboarding for easier development, and you automatically get better memory management (read: less potential for crashes), too.
However, to more directly answer your question... if you're putting the WebView into the view hierarchy with [self.view addSubview:webView], you can remove it with [webView removeFromSuperview]. (This means you'll have to keep a reference to the WebView around so you can refer to it when you want to dismiss it.)
I also noticed in the code you posted to cl.ly an unrelated method -deviceModel which uses uname() to get device information. This is a bad idea, for two reasons:
uname() isn't guaranteed to do something useful on an iOS device (even if it currently does). Use the UIDevice class instead if you need this kind of info, or...
Generally, you don't want to test for the device name to enable functionality in your app; instead, you should test for the capabilities you need. (For example, if you look for a device name starting with "iPhone 4" to test for a Retina display, you'll miss the 4th-generation iPod touch, and the iPhone-5-or-whatever-they-call-what's-next. Instead, use the UIScreen class.)

The best way to implement a login page in iPhone app?

I have been searching the net, and i have found many very good examples on how to create a login page for your iPhone app. However... none of then meets my demands, an since i am new to iPhone development( i know java / c / C++ and objective-c), so the programming itself is not the issue.. The issue is where to put the code and what design patterns to use..
My app is a basic tabbar controller with 3 tabs that could contain navigation controllers, but that is not important.. it is the part before the tabbar controller i am interrested in, namely the need to authenticate the user towards a Lotus Domino Server. I have the authenification code working, so that is not the issue either..
By the way, i am concentrating on IOS5 and using storyboards..
Where do i put the "check if user is still authenticated" code ? The domino server will log the user out after 1 hour, so if the user has the app open(in background) then the code that downloads data will die if the user is not told that the session has expired..
So here is what i would like..
When the app launches, show the login page. This is working for now with the Login View Controller as initial controller, and a modal segue to the tabbar controller..
Next time the App is launched(either from background or from new is user has closed it completely), check if username and password is stored in userdefaults, and then just login in background, and if that fails(password has changed or another failure) then show the login view controller again..
So to sum up, where do i put the "part 2" code ? I have a seperate authenticator class that is using delegates, and i can use this class to perform the authentification, and the it will answer back if all is good.
Do i put this in the AppDelegate code ? If i put it in one of the tabbar viewcontrollers, then there might be an issue with the user having tab2 open when launching after 2 hours, and if the check is in tab1, then tab 2 will fail.. Should i put the code in ALL the tabbar viewcontrollers ? Naaa, that is ugly..
I am leaning towards the AppDelegate(appdidbecomeactive), but can that be used as delegate in my authenticator class ?
That was a bit long, sorry for that, but i needed to explain my problem fully so people would understand what i need..
Thank you for your help.. This is my first post, but this forum is fantastic :)
I'd definitely put both part one and part two code in the AppDelegate.
This allows you to create the appropriate viewcontroller at app start and remove the tabbarcontroller from within the AppDelegate if the authentication times out etc.
I'm not sure about your modal segue to a tabbarcontroller though (I'm not familiar with storyboards yet though). Modal implies you wouldn't be able to present any other view modally on top of the tabbar controller. I think it sounds like it would be much more appropriate to create your logincontroller and tabbarcontroller programmatically and add/remove them directly in your application’s main window as needed from your AppDelegate.
I would tell the AppDelegate to check the login status very time the tab is changed or data loaded.

A Label in View with UIWebView

I have a View, i would like to put a test ( a UILabel) witch when clicking it, it open me a web View with an URL ( WWW.mySite.com).
How i can do this please ?
thanks for your answers
Use a button, put the text into the button, hook up the actions from the button pressedUpInside to a function which will call the UIWebView's - (void)loadRequest:(NSURLRequest *)request with your URL.
Look up Apple documentation on UIWebView and use a UIButton connected to an IBAction. Always turn to the documentation when these kinds of questions come up. It is really through and usually pretty well done.

UIWebView overlapping

hai good afternoon to everyone, I am developing an iPhone web application. In my application I have loaded two web pages in a single UIWebView. After this process has completed, one web page should hide or overlap others whenever they get the user-interaction. However, I don't need this yet. User-interaction also should remain so-far.
You can't have two different webpages in one UIWebView. Instead, you should try to create two UIWebView objects and add them as a subview in a container view.
You can set these UIWebView objects' frame, userInteractionEnabled, hidden properties according to your needs.
Also, you should look at delegate methods of UIWebView. Those delegate methods are called when a page is finished loading or when there is an error exc.
You can read the documentation to learn more about delegate methods:
UIWebViewDelegate documentation