rdio and spotify like now-playing bar in iOS? - iphone

How would one create a now-playing like bar that can be swiped up from the bottom and swiped away from the top, that would always overlap some views but not all views - something like a z-index stacking with swipeable gestures on views?
It should work with something like JASidePanels
On iOs :-)
Screenshot of functionality here:

You should be able to do this by adding a subview to your UIViewcontroller (or JASidePanels, as it may be) and bringing it to the front. Something like:
BottomBarView *bottomBar = [[BottomBarView alloc] init];
[self addSubview:bottomBar];
[self bringSubviewToFront:bottomBar];
Note that this would be from your UIViewController, and not from AppDelegate.
Another option is to add the subview using a XIB or Storyboard and use Interface Builder to make sure that the view is at the right z-index.
To make it swipeable, you just have to listen for the right gestures, and to hide it, use bringSubviewToFront on some other view.

Related

Creating a View popup over another ViewController on iPhone

I am trying to make some kind of popup view when a button i pressed on the iPhone. And it would be nice if I could manage that popup view with a ViewController. I have found out that the UIPopoverController could have been the solution, but it seems that it only works on the iPad...
But anyway, are there any similar solutions for the iPhone?
I am using storyboard
Check out these repos on Github:
https://github.com/werner77/WEPopover
https://github.com/50pixels/FPPopover
Create a separate view controller and resize its xib file and make it look like a popup.
Then ADD this view controller as a subview, and also add it as childController too.
[self addChildViewController:self.popOverViewController];
[self.view addSubview:self.popOverViewController.view];
Now Make it hidden initially.
self.popOverViewController.view.hidden = YES;
If a user taps on Button then using fade in & Fade out animation you can hide/unhide it.
I can tell you how to fade in and fade out if you want to know it further, I hope you can do it easily.
In interface builder make a UIView size of the screen and then make another in that Uiview with the style, size and the such for your pop over. Make its class, hook everything together.
CustomPopUpView *view = [[CustomPopUpView alloc] initWithFrame.....]
Add this all to your UIViewController with
[self.view addsubview:view]
Then attach a tapGestureRecognizer to the back view that animates the whole view off screen when tapped. So now if they click off your pop over view it close it will animates it off screen.
Hope this makes sense.
BooRanger

Instagram-style navigation bar hiding

I need to hide the navigation bar when the user scrolls down. Currently, I'm calling setNavigationBarHidden: YES animated:YES on scroll, but this solution isn't ideal as it makes the main view jump up as soon as the animation is called.
The Instagram app has a much better solution - the navigation bar is locked to the top of the main view, and it scrolls up as the user scrolls. Scroll down a few pixels, and only part of the nav bar gets hidden.
Any ideas on how this could be accomplished?
Check out https://github.com/andreamazz/AMScrollingNavbar.
Its very easy to use, just subclass AMScrollingNavbar in your viewController
I don't think they are using a navigation bar. I think it's custom header view for the UITableView, or at least that's what I would do since you can put any UIView there.
You can use the UITableView delegate to set those headers.
navigation bar doesn't provide this function. the best way is to use a custom view (your custom navigation bar) as a subview of the main view, then do the animations yourself, using functions like [UIView animateWithDuration ....] with translation function using something like CATransform3DTranslate
I have found exactly the way Instagram did it - check out my answer here
No pan gesture recognizers, setting bars hidden, nothing like that, just some cool engineering inside scrollViewDidScroll delegate method of the table view

Hiding ToolBar in a UIViewController

I have a UIViewCOntroller, and in that i have a button and a text field. When i click the button i display a UIToolBar.
Now when i click anything in the background (the textfield or the blank view) i need this UIToolBar to disappear. How can i do this programmatically ?
I know how to add a UIToolBar but all what i need to know is to hide it when the user clicks on the background.
I don't think i will have to paste any code here or show my workings so far, coz i have no clue how to get this done
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setToolbarHidden:YES animated:YES];
}
May be it can help you....
You will need to capture a touch on the views outside of your toolbar to achieve this. If you have a custom UIView base class that all of your other views use, you might start there. Otherwise, perhaps use some sort of toggle to show/hide your toolbar instead in your UIViewController.
The easiest way to do this is to make a single large clear button that is behind the first button but above everything else. Normally have it set to hidden but when you show the toolbar unhide the button as well. When the button is clicked have it hide the toolbar and its self. No need to do anything crazy like sub classes.

How to reliably place built-in UINavigationController UIToolbar on top of iPad view

I am trying to use the UINavigationController object's built-in UIToolbar object in my iPad application, but I want it to be displayed on top of the view instead of the bottom, which is where it defaults.
I am also hiding the UINavigationController object's Navigation Bar.
In order to make this work, I had to write the following code:
navigationController.navigationBarHidden = YES;
navigationController.toolbarHidden = NO;
navigationController.toolbar.frame = CGRectMake(0, 0, 768, 44);
This solution works with one exception: when the application Enters Background and Becomes Active again, the Toolbar is always repositioned on the bottom of the view.
I've tried moving the code from viewDidLoad to viewDidAppear:animated, and it still behaves this way.
First, is there any better way to approach this, and if not, how can I stop the Toolbar from being repositioned?
I've also instead decided to use my own UIToolbar object and add it to each view via a custom Base UIViewController class' viewDidLoad. However, this causes the Toolbar to animate when each view is pushed or popped because it is actually part of the view, which just seems "hokey".
Any ideas on possible solutions?
Thanks everyone!
It says in the documentation under UINavigationController's toolbar property that:
Access to this toolbar is provided solely for clients that want to present an action sheet from the toolbar. You should not modify the UIToolbar object directly.
This is sort of hackish, but you could make a UIToolbar yourself and add it directly to the window (i.e. over the navigation controller.)
You can use the category below to modify the UIToolbar class to achieve what you're after.
#implementation UIToolbar (setCenter)
-(void)setCenter:(CGPoint)center
[super setCenter:CGPointMake(384, 22)];
}
#end
The toolbar has limited functionality when used with a UINavigationController. It only provides a convenient way to manage the actionsheet in the toolbar.
From the docs: "Access to this toolbar is provided solely for clients that want to present an action sheet from the toolbar. You should not modify the UIToolbar object directly."
The solution I would use is to create a subclass of UIView with convenience methods to manage your actionsheet and any other custom functionality you need. This custom view can be shared across all views in the UINavigationController and placed where ever you like in the parent view. This will give you ultimate control of your custom top placed toolbar.

iPhone Toolbar on top of a Scrollview to save UImage?

ive been looking at some tutorials on a toolbar they all are implemented through the navigation controller delegate. Is there a way i could use the toolbar without using the navigation controller?
right now i have a ViewController with a Scrollview in that scrollview i have images when the user uses a touch gesture then i want a toolbar to be viewable and usable to the user just like on the Photo App.
i want to know how i could use the toolbar and make it functional without going through the app delegate and staying on the current viewController.
A toolbar can be created and positioned just like any other view. Don't confuse toolbars with tabbars.