I am using a UITableView to display a list of products in an iPad app. I would like to make this list scroll up and down, not only by swiping the finger, but also buy flicking the iPad vertically downwards (to scroll down a bit) or upwards (to scroll up a bit). I don't know what this iPad gesture is called and how to implement it with a UITableView. Can someone please explain or provide me with some code/tutorial?
Thanks.
You need to use the accelerometer for that (it's not a gesture, a gesture in a movement on the screen with fingers).
Have a look at the UIAccelerometer doc, you will find some nice example for what you're trying to do :
http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/MotionEvents/MotionEvents.html#//apple_ref/doc/uid/TP40009541-CH4-SW5
Hope this helps,
Vicent
Related
I have a collection view in a tvOS project. The cells are fullscreen photos. The view has the default scrolling behaviour: in order to display the next photo, I have to swipe from left to right. This is completely opposite to the “natural” scrolling behaviour used elsewhere in the Apple ecosystem.
This behaviour (swipe left-to-right to display next) makes sense when there’s some apparent focus on the screen, but when there’s just the fullscreen content, it feels completely backwards. Is it possible to change it, swiping right-to-left to display next photo?
I have found a suggestions on the Apple Developer Forums to use UIPageViewController instead. That works, the scrolling direction is as expected.
In my tvOS app, I have a UICollectionView. When I scroll from top to bottom on the Siri Remote, it it moves the view down. This is the opposite of how most Collection Views would work. I want it to behave like a trackpad, when you scroll from bottom to top, have it move the collection view down. How can I invert this scrolling behavior?
You don't want to move away from Apple TV standards. Your goal in making a tvOS application is not to create an entirely different piece of software, but to make your application feel like an extension of the Apple TV. This creates a better user experience when users open your app and everything behaves just as they expect.
I'm wanting to make a UIView which acts similar to the iOS home button action where you can swipe a UIView with a gesture upwards until it is off the screen at which point it is deleted.
Although I can achieve the ability using a standard gesture, it does not give much UX feedback and would like to clone the ability to swipe upwards and make the UIView inline with the touch.
I'm wondering how to replicate or clone this ability where you can press and swipe upwards and the UIView will move in accordance to touch and delete.
thanks
Is it possible to make a view move either to the left or right in the iPad, when I tap on a button, instead of actually swiping on the view.
This can be seen in the iPad when I'm in the screen after the search screen, and I install an app, the screens move to the left by itself and the app sits in the right place and starts installing.
Any suggestion will help.
The home screen is actually a UIScrollView with paging enabled. So it just moves to the next page (with scrollRectToVisible) if a new app is installed. So if you want to have something like that, I guess you have to implement a paging UIScrollView. Just search for that and you will find a lot of good tutorials.
Some further resources:
UIScrollView reference documentation
A paging UIScrollView tutorial
I have a UIView within a UIScrollView. When i want to simulate the drag event on the UIView, swipe event on the UIScrollView is being triggered.
As per the documentation , there isn't much of a difference between swipe and drag.
Swipe
1- Place the pointer at the start position.
2- Hold the mouse button.
3- Move the pointer in the swipe direction and release the mouse button.
Drag
1- Place the pointer at the start position.
2- Hold down the mouse button.
3- Move the pointer in the drag direction.
On an ipad I can use two fingers two swipe and one finger to drag. Now, how do i go about doing something similar on the simulator; drag instead of a swipe?
Edit 1:
I should have been clearer first up. Anyway, my problem is that the mouse drag is firing the swipe instead of drag, thereby scrolling the scroll view instead of passing on the drag event to the UIView contained by the scroll view.
I am on macbook pro. Two-finger swipe on the touchpad is being ignored. Touch and drag is causing the same thing as mouse-drag.
Thanks
See Jeff LaMarche's quick note on how to do this. It's documented in the same page you're reading, but Jeff's explanation is clearer.
If you want to simulate a two-finger gesture in the iPhone simulator, hold down the option key. You will get two dots on the screen instead of one. The two dots will default to pinching - if you bring the dot closer to the center of the screen, the other dot comes toward the center, making it easy to simulate a pinch in or pinch out.
If you want to do a different two-finger gesture, get the two dots the distance apart that you want them to be, then hold down the shift key, while still holding down the option key. That will lock the position of the two finger presses together so you can do, for example, a two-finger swipe.
see this documentation below:
iOS Simulator User Guide
Just use the mouse to drag the view, aka, left click the view then move the mouse
I ended up disabling the scrolling from the UI and added two buttons to scroll the scroll view. Since this is a work around only for the emulator, I have used #ifndef to hide the buttons while building for the device.