Pull-Over View in iOS 7 Similar to Control Center - ios

I'm making an iOS 7+ only app, and I need to have a view that can be pulled from the bottom of the screen, very similar to the system Control Center. Blur would be nice, but that doesn't look like an easy task, sadly.
I want to take advantage of OS 7's UIDynamicAnimator, and the Gravity/Collisions features. But I can't figure out how!
The view will cover about 3/4s of the screen, and be semi-transparent (0.6 alpha). It will contain some controls that I'd like to lay out in IB.
The view should be activated when the user 'pulls' from the bottom 0.25" on the screen. I want it to behave like the control center or lock screen - not a single swipe gesture, but a view that tracks the users' pan, and snaps up or down accordingly.

Related

Is the iPhone touch surface larger than the screen?

[I have a weird iPhone bug, only tested on an iPhone 5S.]
My app has two panes, each of width 320px. When the right pane is fully visible (and the left pane fully hidden), I can sometimes tap a button on the left pane. This button touches the left pane's right border. It is hard to trigger the bug, the trigger surface seems to be on the edge of the phone.
If the iPhone 5S touch surface is no larger than the 320px screen, this should not be possible.
Is the iPhone 5S touch surface larger than the 320px screen? I.e., do the iPhone 5S screen edges have a few extra pixels of touch sensitivity?
It's a problem with your interface, not the hardware. The touchable bounds region of the button may be bigger than the apparent visible drawing of the button. Thus, it may be invisibly sticking into your screen from the left. To confirm this, try making the invisible visible, by giving the button a background color that shows its actual dimensions.
Oh, one more thing. You may be positioning your panes off by one pixel. That would be enough to bring one pixel width of the button onto the screen - and thus would make it, with difficulty, tappable.
Since both panes will never be visible simultaneously, why not avert this entire issue by adding some space between the panes?
You can check pane (button) location by printing it's frame into console. Now you know for sure, if button edge is on-screen or not:
NSLog(#"%#", NSStringFromCGRect(button.frame));
Btw I'm wondering, if this could be related to iOS7 feature "(New gesture - Swipe left to right - as shortcut for Back button in UINavigationController in old app)"?

iOS 7 Pullable view

I'm looking into implementing a subview in a view controller that will sit as a bottom bar of the screen until the user holds down and pulls it up to the top of the window to cover the whole screen.
What Google Maps does in Android/iOS with clicking on a pin and pulling the bottom bar up to see details is exactly what I want to implement.
Here's what I'm talking about. I'm not sure what the best way is to implement this.
I can either have an animation that is hardcoded when the bar is clicked causing the view to expands up and cover 3/4 of the screen and anchors there and 1/4 of the screen will be a map and once the map is clicked will drop the view back down. Or have the user drag and pull up the view and pull it back dock to anchor.
You should have look at demo code from following github link which have implemented pullable behaviour similar to the Notification Center in iOS:
https://github.com/crocodella/PullableView

Trigger or Delay Auto Rotation in iOS 7

Is it possible to delay or trigger auto rotation in any way in iOS 7, without switching to a new view controller?
Consider the example of Siri on iPad. When Siri is activated, the application running behind it is deferred and blurred with Siri's transparent interface laid over top. If you rotate the device while using Siri, nothing happens, but upon dismissing Siri, the auto rotation event finally fires.
I'm accomplishing a similar blur/defer effect in my application by taking a snapshot of the window, blurring/scaling it, placing it over top of the view being displayed, and placing additional transparent content over top. Because this is a snapshot and cannot resize on-the-fly, I prevent auto rotation from occurring (like Siri) with -shouldAutorotate returning NO high up in the view hierarchy. Once this state is dismissed, I once again allow auto rotation, but no rotation is triggered. This is because the rotation that occurred while the app was in this blur/defer mode was ignored.
Is it possible to trigger auto rotation to occur to properly rotate to the device's actual orientation after I return from this mode?
Here are my three suggestions:
Use a live blur view and allow animation. There are many open-source implementations, most of which use a stretched toolbar or its blurring CALayer. This will allow you to support rotation as well as have a live view under the blurred background (like Siri). Edit: After digging around, I found out that certain open-source implementations, which were taking the CALayer of a toolbar were rejected by Apple. By taking a toolbar and stretching it seems safe.
After taking a snapshot of the key window, display that snapshot as the root view of another window which is displayed above the key window. If I recall correctly, a view alone, without a view controller attached, will not rotate when added to the window's view hierarchy. (If it does, it is very easy to counter using a counter-transform.) In essence, you will achieve a non-rotating view. The window below will rotate normally, however. When dismissing the snapshot holding window, fade it out so that the view hierarchy below is smoothly presented to the user. Drawbacks of this approach is no live preview of the blurred background, the rotation animation will not be seen by the user.
Rotation in iOS is basically the view controller setting a transform to the view, if all conditions are met and it is determined that interface rotation is supported. In the view controller responsible for the blurred view, counter rotation with inverted transforms. This should make views appear as if not rotating. Once it comes time to hide the blurred view, use an animation block to reset the transform, which will create the same animation as rotation. If you combine this approach with a live blur view, this will recreate the native Siri experience 1:1. Your only problem will be the status bar will rotate regardless of the view's transform, because it gets its transform from a different system. There are gray-area remedies for this.
These recommendations are sorted by ease of implementation. Each can be implemented by itself or a combination of 1+2, 1+3 or 1+2+3.
Siri follows different rules. It is a whole different application (and a privileged system application at that) that is displaying on top of the previously frontmost application.
As for your situation, the thing to do is probably to present a full-screen modal view controller on top of the current view controller that only allows the current orientation. Then, when it's dismissed, the previous VC will allow rotation again and everything should pick up where it left off.

Making a pull out tray - (iOS)

I'm making an iPad app, and basically, I want to make a tray that pulls out from the bottom of my app, and I'd like to have a little tab at the bottom of the screen that if you pull, it brings up an image, and the image's height would match the height you pulled the button to. It's a bit like how the notification center works, except the tab is always visible.
So my question is how would I have the image follow the tab as it moves vertically across the screen? I would assume using a UIButton for the tab and a UIImage for the tray would make sense, and I have some code for making buttons move, but how can you make one object follow another?
Thanks for your help,
-Karl
I wouldn't use a button for the tab -- just a regular old view.
To make your image follow the tab (however you implement either of them), simply animate them both together. That is, if you create an animation that moves the center of the button to the Y-coordinate of the user's touch, you can at the same time move the image vertically by the same amount. The two objects will then seem glued together because they move together.

iPad Toolbar UI Question

I need to have an iPad app that has a consistent toolbar at the top of the screen. I need it to adjust when switch from landscape to portrait. Essentially what I need is something that acts like a UINavigationController, but allows me to have an arbitrary number of buttons like a UIToolbar. I've seen this done, but I can't figure out how to do it.
Thanks
There is no reason you can't just use a standard UIToolbar at the top of the screen, rather than the bottom. This allows you to add as many buttons as you can squeeze on, and customise their appearance.
In order that it should adjust its size when switching interface orientation, you simply need to adjust its autoresizingMask property. This is easy in Interface Builder - just turn on the horizontal arrow in the middle of the autoresizing box (this makes the width flexible), and maybe make sure that the left, right and top struts are enabled to so as to hold it in the correct position.

Resources