Swip from one view to the next view - iphone

I have an app with two views and ViewControllers. How can I let the user swip from one view to the next view like in the homescreen or the weatherapp.
I know that there is a page control in the Interface Builder, but it is just an Indicator on what page the user is.
Thanks and sorry for my bad english!

Check out the PageControl.xcodeproj from Apple's iPhone sample code. It provides a template for doing exactly what you want.
The actual paging is done using a UIScrollView in page mode with horizontal scrolling (which is what causes the scrolling to "snap" to a page boundary).

Related

UIScrollViews won't scroll to top on my app structure

First of all, sorry about my english.
I have an issue with the scroll views of my app. I know that I can have only one scroll view per view controller in order to avoid problems with the "tap the status bar to scroll to the top"; and I have only one per VC, but all the VC are inside a bigger one, that handles the view sizes and the interface orientation. This is the structure:
Main View Controller
Page 1 (View controller)
Page 2 (View controller)
...
And the only scroll view that works with the status bar is one inside a UITableView on the Page 1.
Finally, the question: Anyone knows how to fix this issue without changing the main structure of the app? (there are a lot of pages).
Thanks in advance, and really sorry if I made some noob mistake :P.
Regards
I just answered a similar question.
scrollToTop is not working on iPhone but it is working on iPad
Since you cannot change the design of your app take the UIWindow subclass / category approach and do the scrolling yourself

iPhone Loading Popup Scroll Down

is there anyone knows a lib for creating a simple view that scroll down from the top of the screen for "Loading.." message?
Like http://github.com/matej/MBProgressHUD but the view should scroll down when begins to loading and scroll up when finish.
It might seem a little jarring to the user to scroll down and then back up. It shifts the users view of the data down and then back up without user interaction ...
I would simply overlay the loading view ...
Objective C: Adding Loading View to View Controllers
Check the code here: Simple Notifications for iPhone. Sorry for Russian, but the idea should be clear. You just need to add transition from the top of the page when notification label is shown.

Webview and another View within UIView

So I have a UIViewController, and within that I have two views, a WebView and another view that I made (taken from this tutorial: http://www.raywenderlich.com/1768/how-to-make-a-custom-uiview-a-5-star-rating-view).
In the nib file, I have the rate view on the bottom; but when I run the simulator and go to that view, I don't want the rate view to be on the bottom ALL the time; only when I am at the bottom of the WebView.
(Sorry for not being more clear, basically the Rate View would be like a part of the WebView on the bottom, and the user would see it if they scroll to the bottom of WebView).
probably not an answer, but the easiest thing would be to incorporate that second view into the content of the web view page. If that's not possible, you could try putting the 5 star view and web view inside of a UIScrollView, but it may cause problems with event handling. Another possibility would be to try to detect when the web view scrolling reaches the bottom and then pop up the 5 star view from the bottom (from off-screen). I think that can be done since UIWebView conforms to UIScrollViewDelegate.

Add an animated top bar to UIWebView

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...

Need help designing application with UIPageControl and UIScrollView

I have looked at the PageControl example from Apple and have an architectural requirement difference. In the example the scroll view and page control objects are at the app delegate level. This means the scroll view and page control appears on every view of the application.
However, I have a "settings" view toggled from an info button (for now) that should not have these controls displayed. Therefore, I need to move my scroll view, page control, and view controllers objects down a layer and I'm struggling with how to best do this.
For example, the primary application view consists of metals (periodic elements). From this view I need a scroll view, page control, and info button on every view descending from here. Each metal will have it's own subclass where different images, calculations, etc will be displayed but I believe I need each of these subclassed elements to share the same scroll view, page control, and viewControllers array, right? Do I need a singleton?
What you are describing is kind of like how the native Weather application works. Each time you swipe, the info light is rendered as part of the page you are viewing. However, no matter what info light you tap, when it flips over you still get the same settings. Obviously this is how Apple thinks the UI should work because they did it that way. There is no reason you can't do the same.
In this situation, you don't need to create a singleton, you can use [UIApplication sharedApplication] as your singleton to get to your custom application delegate via the delegate property.
Look at Crème where I do exactly what you describe. The main view is scrollview+pagecontrol. Upon triggering the app into settings mode, the settings panel comes up that does not have a page control.
The solution is simply that you have a simple top-level UIViewController, and you make both the scrollview and pageview children of that viewcontroller. And for settings, you animate the modal settings dialog with a flip animation into the top-level UIViewController.