I have a scrollview with all my data to be showed and I want the user to trigger it being updated. The user should pull the scrollview downwards, then a small view will be shown that was previously hidden and that says: "updating" or "release to update".
Look at the iPhone facebook app and you will see what I am talking about.
They did it pretty awesome, they have a small animation that and an arrow that makes it easy and intuitive.
However when trying to replicate this behaviour I have found that the UI is blocked until the scrollview delegate function was run. This is impractical because I want to update the UI from that scrollview delegate function.
So when the user holds the scrollview in a dragging motion, there should be a small animation or so that tells him to release it or hold it longer.
- (void) scrollViewDidScroll:(UIScrollView *)scrollView
{
CGPoint topOffset = CGPointMake(0, 20);
if (self.contentOffset.y < 0 )
{
labelUpdate.text = #"Release to update.";
//do something here to update the UI
}
}
Search google for pull down to refresh
I would recommend you look into the Three20 library. Chances are that functionality has been incorporated into that library so you don't have to make it from scratch. (I haven't looked into the Three20 library for awhile so I can't confirm or deny this for sure, sorry.)
You might want to use an existing framework. A couple of them are mentioned here.
Three20's TTTableViewController
The first time I saw this functionality was in the Tweetie(now Twitter) app and now the Facebook app. The first developer of the Facebook app created an open Framework called Three20 and coincidentally Three20's framework has a demo twitter app on github. To use the 'pull to refresh' functionality though you might have to use Three20's TTTableViewController which uses url paths to keep track of navigation so you might have to adapt your app to use that but there are plenty of tutorials for Three20 like this one.
Thanks for all the answers,
ultimately I have chosen this solution:
https://github.com/leah/PullToRefresh
because it simple and it works. Additionally I have refactored the ViewController shown there into a simple UIView type that you can comfortably use with any UIScrollView derived class.
A link with code will follow shortly.
Related
I am trying to develop an application whose view closely matches with groupon app. User should be able to swipe on the screen and the entire screen changes with top pointer pointing to different tool bar entity.
Any pointer of how to go about it?
Take a look at UIScrollView Reference and PageControl Reference from Apple Guides
Hope it helps,
Mário
Looks like a pagecontrol+scrollerview
The complex part is making the toolbar elements move when you are changing the page at a different speed
I've got an app that appeals to an older demographic. The interface is simple but with some custom controls where a simple graphic is not completely self explanatory (save to playlist, sort by genre for example).
I've seen plenty of apps with great first run walkthroughs (examples here) but don't know if there are some existing libraries out there.
Your suggestions are welcome.
I found CMPopTipView that, while it doesn't fit my needs completely may be of use to those that are looking to pop a tool tip every now and then.
Most of these overlays/walkthroughs can be accomplished by adding a subview to the main window of your app. There are some edge cases to take into account, but for the most part, you need to simply grab a reference to the key window with
UIWindow* keyWindow;
keyWindow = [UIApplication sharedApplication].keyWindow;
You then would add your overlay view as a subview with:
[keyWindow addSubview:anOverlayView];
Handling taps to dismiss the overlay can be done with a tap gesture recognizer.
If you are looking to create a click-through demo which runs in the browser and on mobile devices, AppDemoStore is the right tool for you. You just have to upload some relevant app screenshots, add hotspots for the navigation between the screens and callouts for explanations. It takes only a couple of minutes and it's free.
Regards,
Daniel
Can someone give me one source file working ?
Alternatively you can look at my AQGridView, which can display anything in a grid, using an API similar to that of UITableView.
You might want to take a look at Facebook's Three20, specifically their TTPhotoViewController class.
Update: Other options (possibly more modular and easier to integrate in your project):
https://github.com/mwaterfall/MWPhotoBrowser
https://github.com/kirbyt/KTPhotoBrowser
http://github.com/alanQuatermain/AQGridView (as suggested by Jim)
First of all, the question is very simple, but I have tried to look around on the Internet and I couldn't find a name for this. Several applications such as "Ping Lite" have used this view in their application. It allows you to have submodules/applications as icons and you can scroll the page around just like when you are at "home" screen.
Can somebody tells me what is the name of the class that is used there?
This kind of view is not available in the iPhone SDK. It is written by Apple and it's not included in the UIKit framework. It's only available in SpringBoard.app, the application responsible for many features of the OS (kind of Finder.app).
However, you can write it yourself of course, using a UIScrollView. This will take some time but luckily we have the Three20 project, which implements the TTLauncherView class
AFAIK the standard sdk has no such a class. You can check third-party libraries(three20, for example) or customize UIScrollView behaviour
The UIView used at the “home” screen of iPhone is a UIScrollView alongwith UIPageControl.
Check the PageControl sample code from Apple and you will learn how it works.
Does anyone know what is the name of the button in the right corner of the toolbar in the new Maps application? It's the button that unfolds the map and the view underneath offers buttons to switch between map modes. I would like to use it in my map application if it's a part of the SDK!
EDIT:
Thanks for your answers!
What is an undocumented method? And how come you can use this stuff but it's not really desired by Apple? Will it be released in a future SDK? I don't see the point in creating an app that has features unavailable for all developers. This is a lot of questions, please point me to resources where I can find out more about this process if you know any (like where do you know all this from)?
Also, where can I find types of animations for views, like the one Cory mentioned?
It's not part of the SDK. The actual file names of those images are UIButtonBarPageCurlSelected.png, UIButtonBarPageCurlDefault.png, so probably you can call it the "page curl button".
The unofficial way (warning, rejection, etc.) to get this button is to use
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:109 target:... action:...]
To download a UIImage of these images from UIKit to add them into your project later, use [UIImage kitImageNamed:#"UIButtonBarPageCurlSelected.png"] and so on.
There's no standard UI component for this button, sorry. If you're resourceful, you could probably figure out a way to pull the image out of Maps, but Apple might not take kindly to using their art in non-approved ways.
The only EASY way to do this is to use an undocumented method. This is banned by Apple and will result in having your application rejected from the app store. You can create something similar with UIViewAnimationTransitionCurlDown or UIViewAnimationTransitionCurlUp but these will cause the view to curl all the way up and not stop halfway.