Map-like UI navigation on iOS - iphone

I'm experimenting with a UI concept where my views are laid out like a net and the user can swipe in different directions to navigate through the app. Here's a very rough mockup:
I understand I can use UISwipeGestureRecognizers to trigger animations, but I'd really like to move the views WITH the user's finger as they swipe, like Clear for iPhone does when you swipe up or down, or like Readability & Reeder do when you swipe back.
Any ideas how I might achieve this?

Have a look at the example for handling touch events directly, especially UIResponder's touches moved : https://developer.apple.com/library/ios/#samplecode/Touches/Introduction/Intro.html

Related

UIScrollView stopping my UIGesture from doing view transition

So I am working on this project here, to test some things that I am interested about, such as view transitions using UIGestures.
I am currently testing how view transitions behave when they have things like UIWebViews and UIScrollViews in them. What I have found out currently is that if you have a UIScrollView bigger than the view frame then the transition (using gestures) is blocked if you are using a UIGesture to change the view. (Such as swipe left or right)
I was wondering if there is a way around this or a solution that I don't know about..
Try using
gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:
return no for it and see if that works.

Using UIPageViewController and making the view look like it's flapping

I'm wondering if there's a way to animate the very first view in UIPageViewController so that it looks like the one of the page corners is flapping a little bit? As if a little breeze bristles the pages when you first arrive on this particular screen.
This to add some sort of UI affordance to indicate that screen can be swiped. The content we're displaying with UIPageViewController doesn't take up the entire screen like a book does but would like to make it more obvious to the user that they can use gestures to navigate horizontally.
Any suggestions would be helpful.
Have a look there: https://github.com/brow/leaves
This guy made a new ViewControllers / View class allowing this kind of animation.
Hope that helps.
How about overlaying an animated GIF in the corner of the page bobbing about a bit, which you can then dismiss as soon as the user interacts with the page? (I know GIFs are a pain to work with on iOS, but it's certainly possible.)

iphone switch views by swiping fingers to left and right, similar as the stock app

I am interested in how the lower portion of the iphone stock app is implemented. The lower part of the app, where you can switch the views by swiping your finger to left/right and the "..." below the view to indicate which view the user is looking at.
It looks to me a tabview component. I am trying to look for the UI component as well as google it, but i have not yet find anything like it. Most of the examples I found are using scroll view. When you swipe the finger to left/right the scroll bar appears, and more importantly, there is no "..." under the view to indicate which view the user is looking at.
Could anybody point me to a similar example?
Thanks,
Thomas
It's a UIScrollView with pagingEnabled set to YES taking up most of the screen with a UIPageView underneath it. See Apple's PageControl sample code for details.
You can turn off showing the scroll indicators by setting the showsHorizontalScrollIndicator and showsVerticalScrollIndicator properties of the scroll view to NO.
It might also be worth checking out the PhotoScroller sample code for an in-depth example of how to do pagination using a UIScrollView. There's also a great video called "Designing Apps with Scroll Views" that walks you through paginating views using a UIScrollView in the WWDC 2010 videos. I highly recommend watching it and the other WWDC videos. You can get them by signing into the iOS developer center and scrolling to the bottom.
Also, like they tell you in the video, you don't need to use touch events or override touchesBegan:withEvent: or similar functions to make this happen. If you do it that way, you have to do lots of work to pass events that you don't care about through to the views you're showing and stuff like that. UIScrollView with pagingEnabled set to YES does all of the hard work for you.
If you don't want to use a scroll view for some reason, using a UIGestureRecognizer is the way to go. But really, just use a scroll view.
This is called touch events. more so Swipe touch on the iphone.
And here are two examples.
Heres a code snippet:
You first need to tell the application that touchesBegan.
You can find some details on the API for this. Then the delegate methods will be called automatically everytime a user touches the iphone screen.
- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event {
UITouch *touch = [touches anyObject];
if (touch.info & UITouchSwipedRight) {
[self changeViewRight];
} else if (touch.info & UITouchSwipeLeft) {
[self changeViewLeft];
}
return;
}
check this example:
http://devblog.wm-innovations.com/tag/touchesbegan/
Its a really good example.
Hope this helps.
Let me know if it did a little. Thanks
PK
Take a look at following link, it might be nice approach to navigate through views on swipe.
Views Navigation Using Swipe Gesture

Springboard-like scrolling/view switching with snapping on iOS

Is there a way in cocoa touch to implement view switching behavior like the one in iPhone's springboard? I mean horizontal scrolling with 'snap to view' animation (views are switched only after certain 'scrolling' threshold has been reached)
Look at the 'pagingEnabled' property on UIScrollView.
SpringBoard, App Store and Mobile Safari use a UIPageControl in conjunction with a UIScrollView to provide the little dots you see at the bottom of the screens, that you swipe across with that snap effect.
What views you want to swipe through depends on your application, though, as you're essentially swiping through a UIScrollView.
This isn't an answer, but I know it's possible. I have seen this behavior in "Twitter for iPhone" and asked myself the same question. If you use that app, check out what happens when you swipe the individual tweets to reveal more controls underneath.
This looks like it's part of TableCellView and some touch drag combination. As for the implementation of that... well, im too novice right now.

Drag & sweep with Cocoa on iPhone

I'm about to start a new iPhone app that requires a certain functionality but I'm not sure if it's doable. I'm willing to research but first I just wanted to know if I should at least consider it or not.
I haven't seen this in an app before (which is my main concern, even though I haven't seen too many apps since I don't own an iPhone), but an example would be the iPhone shortcuts panels: you can hold on an app, and then drag it to another panel, sweeping while still dragging it. But this is the core app, is it possible to reproduce something similar within a normal app?
I only need to be sure it can be done before I start digging, I don't need code examples or anything, but if you have some exact resources that you consider helpful, that would be appreciated.
Thanks!
Yes. If you have your custom UIView subclass instance inside a UIScrollView, your view controller just needs to set the UIScrollView to delay content touches and not allow it to cancel touch events.
[scrollView setCanCancelContentTouches:NO];
[scrollView setDelaysContentTouches:YES];
When the user taps and holds in the custom view, the event goes to that custom view, which can process the touch events to drag an item around, but if the user quickly swipes, it scrolls the view.
The "panel" view that you're referring to appears to be a UIPageControl view — although, perhaps, the specific incarnation of this view that Apple uses for the iPhone's home page may be customized.
Instances of generic UIView views that you might touch-and-drag will receive touch events. By overriding methods in the view, these events can be processed and passed to the page control, in order to tell it to "sweep" between pages.
If I wanted to do what you're asking about, that's how I might approach it. It seems doable to me, in any case.
Start with this: Swip from one view to the next view
Try using a UIButton that tracks the time since the state of the button changed to "highlighted". You may need to do this in order to track the dragging and move the button around:
Observing pinch multi-touch gestures in a UITableView
Check to see if the button starts overlapping one side of the screen while being dragged. If s certain amount of time elapses since the button first started overlapping the edge and then manipulate the UIScrollView so that it switches to the next page on the corresponding side of the screen
You may need to use NSTimer to keep track of how long the button is held down, etc.
In any case there's no reason why this couldn't work.
If UIButton doesn't work then perhaps try a custom subclass of UIControl (which tracks the same touch down actions etc.). If that doesn't work then use the window event intercept thing to track everything.