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.
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.
Here's my user's iPad requirement. Two users are sitting down at a table with an iPad between them. Each user needs the ability to "take control" of the app by doing a gesture to rotate the screen towards him. This would be equivalent to picking up the iPad and changing its rotation to face the user. A few questions about this:
1) Is there any default behavior within iOS to to be able to do this?
2) Do you know of any apps where this is done so I can see it in action?
3) Lastly, how do I go about enabling this functionality for my app? This functionality should be available for all UIViewControllers within my app.
I'm no expert on the topic, but here are my thoughts:
If you want to also have the app respond to device rotations, the proposal is a bit more complicated. However, if you want to eliminate physical device rotation reactions in favor of rotating the app yourself, there are only a few steps necessary:
Stop the views from auto-rotating. In iOS 6, this is as simple as implementing the shouldAutorotate: method and returning NO and the supportedInterfaceOrientations method to only return the one orientation you want to allow in the view controller at the root of your controller hierarchy. In iOS 5 and earlier, you want to implement the shouldAutorotateToInterfaceOrientation: to only return YES for one orientation in the view controller that is at the top of the view controller hierarchy.
Add code that reacts to the gesture you want to use to rotate the screen (maybe a gesture recognizer).
When the gesture is performed by the user, rotate whichever view is at the bottom of the view hierarchy in your app. Likely, you will rotate the view managed by the rootViewController. Remember that you will need to deal with the new size of this view, not just the orientation. To affect the rotation, I think the best route is to apply an affine transform to the view's layer. This is pretty helpful if you are not familiar with affine transforms.
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 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
I want to create a full Screen Cocoa application, however my app is slightly different from a conventional fullscreen app.
This app would be below everything else, so underneath the menu bar and the Dock, etc. It would have a large image covering up the Desktop and icons, with a custom NSView in the middle with a table view, etc. If this concept is hard to understand then here is an image:
http://img10.imageshack.us/img10/6308/mockupo.png
The only part that might be a bit confusing is the background image. This background image is NOT the wallpaper of the computer, but part of the app. So when the app is launched, it goes into full screen mode and puts itself underneath the dock and the menu bar, and underneath all other windows too. So it draws the background image to cover the screen (including Desktop and icons). Then has a custom NSView in the middle containing my controls.
What's the best way to go about doing this?
Thanks
Make a borderless window, the size of the menu-bar screen (screen 0—not [NSScreen mainScreen]), positioned at 0,0, with window level kCGDesktopWindowLevel.
Remember that you will need to observe for screen frame-change notifications (when the user changes the screen dimensions), and that you should correctly handle the case of no screen at all (headless Mac).
I think #Peter Hosey’s solution should work, but to make other windows go on top, you will probably need to change the window level to something else.
But, I implore you, do not do this. This will be the most bugly application the Macintosh has ever seen. There are a lot of really good user interface paradigms that you can use, and "replicating" the main desktop interface of Mac OS X is generally not one of them. That is, unless you are reimplementing Time Machine or something like that.