I'm wondering how to go about implementing a draggable viewcontroller such as that in the Facebook app where the user can drag from the far left of the screen to the right and the viewcontroller will follow, revealing another view underneath. I'm not looking to rip off this design, I just find it to be a very interesting way to display extra information and I'd like to learn more about draggable interfaces.
Now I'm somewhat familiar with UIPanGestureRecognizers but I imagine this is far more complex?
Where would I start?
I've used this with pretty good luck:
ECSlidingViewController
I did my research on all the options at the time (like a month ago) and this is most like facebooks because you can drag anywhere on the screen to move it. Also this supports both orientations
You can find solution here: How to move an UIViewController?
In that example you can drag viewControllers by swiping navigationBar
In that example FronViewController viewDidLoad method contains code:
UIPanGestureRecognizer *navigationBarPanGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self.navigationController.parentViewController action:#selector(revealGesture:)];
[self.navigationController.navigationBar addGestureRecognizer:navigationBarPanGestureRecognizer];
and ZUUIRevealController contains method to handle recognizer:
- (void)revealGesture:(UIPanGestureRecognizer *)recognizer
Related
I'm trying to implement 3D Touch feature that presents a summary of information (like Peek). But I don't want that it pops. I just want to preview the information like contacts app does with contatcs:
It only presents an UIView and doesn't deal with two levels of force (peek and pop).
How can I do something like this?
Ps.: I don't want to deal with long press gesture.
Introduction
Hello
I know this is a bit to late, probably, but in case someone else stumbles upon it: I certainly believe it is possible and I don't think its a "native behavior for contacts". Although it would not be as simple as the UIKit api for peek pop views. You would need to:
Steps
subclass UIGestureRecognizer (perhaps it may work with the UITapGestureRecognizer also), and register UITouches and use their force property.
Setup a UIViewController with transparent but blurred background around the edges (together with a modalPresentationStyle .overCurrentContext if i recall correctly), with your desired content in the middle (much like the peek view). Then add a UIPanGestureRecognizer to the center view for dismissal/sliding up the buttons.
And then create a custom animation transition for that UIViewController to be triggered once the force property of the registered UITouches from the subclassed UIGestureRecognizer is high enough. And then reversed once the force property gets low enough.
Concluding notes
I believe this is a bit of a tedious task and there might be a simpler way. For example, a simpler way using a 3rd party library for long pressure gestures (that registers size of the touch), but it would not give the same feel.
I'm attempting to make a Popover similar to the one seen here : http://i.imgur.com/wDNOo44.png
This popover is meant to be an IBAction from the button, which in this image is titled: "Ventral Primary Ramus". I've looked around the internet for tutorials and I have mainly seen tutorials on creating popovers from the UIBarButtonItem. For this popover as you can see I need to be able to title it, as well as in then display text information about the structure who's button was pressed. Along those same lines how would I go about making sure that the window will auto-fit to the text?
There is many tutorials for this. For example:
appcoda
raywenderlich
It's really easy to present some popover, just read this.
I have a 2 UIViewController(s), I need to be able to change the views at the bottom of the Airtime and Data Plan Upon tap gesture on Airtime and Data Plan!
The yellow line will indicate the active view controller. some thing like tab bar.
Perhaps, the image attached is an android version
Could anyone provide a help on how to go about this.
Thanks
I personally use a library called ICVIewPager
https://github.com/iltercengiz/ICViewPager
This is pretty simple and easy to use with examples. It should put you in the right direction without writing a lot of code.
I want to build an iPhone app that displays a floor plan of different regions/rooms. When a user taps on a region/room, it shows the hit-state color for a fraction of a second before sliding to a new UIView with additional text information.
Should I be setting up all the different regions via UIImages or should I draw my own floor plans programmatically? I tried drawing some rectangles programmatically, but wasn't sure if it's possible to attach tap event handlers to the graphics. Or if it's easier to maintain floor maps with unusual shapes programmatically.
My requirement was same like you. See my Question. Finally i am go ahead with UIScrollView with Zoom in out functionality. I have add multiple UIViews in Scroll and all UIViews have UILable So it will look like Room / Booth and it will look like this Question. To archive this i have face one Query and finally resolved this and implement the Floor Map Like my 1st question link.
Now to resolved your question that You have to implement UITapGestureRecognizer like below code.
UITapGestureRecognizer *fingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:#selector(handlefingerTap:)];
fingerTap.delegate = self;
[fingerTap setNumberOfTapsRequired:1];
than you have to set this Gesture to your view and implement the tap method like below
[rigionView addGestureRecognizer:fingerTap];
- (void)handlefingerTap:(UIGestureRecognizer *)gestureRecognizer
{}
If you have add multiple UIViews in Scroll than implement the above code in for loop.i have done the same.
I hope it will help you..
I've been banging my head with this issue for the last two days. Googled a lot but wasn't able to find the answer yet, so I decided to request some help here. Let's see if I get any luck.
I'm coding a reusable control that consists of an UIView with a variable number of customized UIButtons. I implemented initWithFrame:, initWithCoder: and drawRect: where the buttons (which are built prior to drawing) are actually added to the view. Everything is done programmatically since the UIButton content should be supplied when using the control, so there's no XIB for this UIView.
This UIView, let's call it CustomizableBarButton is then used in an UIViewController, let's call it MyTestViewController with a view on it, let's call it customizableBarButtonView.
MyTestViewController's GUI was set on IB where an UIView was tied to customizableBarButtonView (the class was matching accordingly).
MyTestViewController's is a pretty standard class except for the viewWillAppear: that initializes the buttons and passes them to the CustomizableBarButton along with some other options.
The issue is that everything works perfectly...except for the first time!
I mean, when I run the app on the simulator (I haven't tried it on the iPhone yet but I strongly believe that it's not an hardware issue) the MyTestViewController shows the customizableBarButtonView background but not the buttons. Now when you click on the place where a button should be all the buttons suddenly appear!
I'm puzzled since the CustomizablebarButton drawRect: runs before the strange "click n'appear" effect and the buttons are actually added to the subview.
Another hint that my help: if you don't click on the buttons (so you still got no buttons yet) but rotate the device they will also appear as if by magic!
It is probably something very simple but I'm missing it and I'm going nuts...
Can someone lend a hand on this, please?
Thanks in advance!
You said you're adding the buttons in drawRect:. Don't do that. You need to add the buttons in your init methods.