How to create bottom sheet style model view controller using Swift? - ios

I am trying to create button click to present bottom sheet viewcontroller using storyboard not code base. View controller swipe down to dismiss viewcontroller with background light dark effect.
I tried below cocoapods but I didn’t get easy way.
https://github.com/gordontucker/FittedSheets
Please, give me some ideas how to achieve this by using Storyboard?

Might be too late but I juste released a Framework that does exactly what you need.
https://github.com/Que20/UIDrawer
It is a custom UIPresentationController, it doesn't affect you view controller presenting or the modal itself.
It support swipping and dragging (to deploy and close).
It is customizable.
Hope it'll help :)

Related

how to handle popUp's next viewController to embed in navigation?

I have a tab bar, an every item of it embedded in navigation controller, and several child viewControllers!
and I have a pop up view which I created in a new viewController!! to show my popUp I had to choose "present modally"!
when I go to a new viewController from my popUp on pressing button, it's not embedded in my navigation controller!
is there any way to fix it?
and the new viewControl also stays embed in navigation to show my tab bar
Unfortunately, what you are trying to achieve is not right, and please do not proceed with your initial plan.
I strongly believe a quick look at this could help you understand better UINavigationController and the difference between push vs present UIViewController in iOS.
As an answer to your question, you can imitate your wanted behaviour, but there is no direct native iOS way to accomplished your goal. Better, use pushViewController:animated: instead of present. More in the apple dev site - here.

How to make SWRevealViewController slide "over" the main view controller not "push" it out?

I'm using SWRevealController with swift and it is working how it is suppose to but I would like to tweak it a little.
When you bring out the menu, by either sliding or pressing the button, the new view comes out while pushing the main view controller to the side.
What I would like to have it do is slide over the main view controller so the main view controller stays where it is with the new view controller sliding over top of it.
Does that make sense? The only example I can think of is on the Reddit News app for Android. The slide out menu doesnt effect the main view controller it just slides out on top of it. (I know its different in Android)
Is this possible to do while using the SWRevealViewController class?
what you're trying to do isn't the expected behavior of SWRevealViewController and thus it would require some low level coding for you to tweak an animation the way you're describing.
However i'd recommend using this pod instead https://github.com/jonkykong/SideMenu. It's an updated version and as you can see it provides several animations for you to choose from, the one you're looking for is Slide in. It's all really well documented.

Shrink view controller while presenting another

I want to modely present a view controller, and during the animation I want to shrink the presenting view controller. I saw a lot of apps doing this effect, its seams that the entire view controller including the navigation bar is shrieked.
I'm not sure how to approach this, and I will really appreciate any help about how to make this kind of effect.
here is an example from the mail app, you can see that when the compose view controller is presented, the other view controller is shrieked behind him:
If this was for iPad I would tell you to simply use an embed segue, or resize your modal container's superview, but since it is for iPhone that makes things trickier. Apple has said that modal presentation for iPhones is always supposed to be the whole screen, so I doubt they did theirs modally. They either made a custom segue type (I'm not sure how to go about doing that), or they simply are using a view and presenting that on the bottom portion of the screen, with a view inside of it to represent the navigation controller.
You can add a different viewController's view to the current view controller then call parentVC addChildViewController: and use it like that. Just use a toolbar instead of a nav bar and it should work fine.
I was looking to do the same and I found this answer by Brian Sachetta that explains how to accomplish it. The link posted in the answer didn't work for me but I found the sample he is talking about here

How to integrate custom view with TabBar?

Well I wish there was some tutorial anywhere or any of the O'Reily Cookbooks would explain this but everyone only ever talks about using UITabBarController.
What I need in my app however is a custom view (basic UIViewController) with a NavigationBar (just for the title bar and a 'Done' button) and a TabBar in it.
The question is: How do I integrate the TabBar and connect views to each bar button (and add more bar buttons)? Can this only be done programmatically or is it possible in Storyboard? And which class needs to be the TabBarDelegate (I suppose my custom UIViewController)?
Does anyone know of a good guide for this or provide me with some hints?
Thanks.
UPDATE:
I decided to simply check in the TabBarDelegate for the tabBar.selectedItem.tag and instantiate a sub view accordingly from the storyboard and add it into a ContainerView that is sandwiched between my nav bar and the tab bar at the bottom. This works so far (although I'm not sure if there's not a better approach) but now I'm facing a different problem:
When a sub view is loaded into the ContainerView the whole tab bar disappears. Does somebody know why this happens?
It is very easy to crate Tab Bar Controller app with Storyboard. Apple even provides a snippet :) When creating a new project, just select iOS -> Application -> Tabbed Application.
Also, here is a pretty good tutorial: https://www.youtube.com/watch?v=RhsHtd6rAiQ.
Solved the original issue myself by creating a Xib with UIViewController in it and place a UITabBar and a UIView as container for subviews. Then load the xib with NSBundle.mainBundle().loadNibNamed() and create Xibs for the sub views that should be loaded and load these with loadNibNamed() and add them with viewContainer.addSubview().

How can I change the Storyboard animation for modal in Xcode 4.2?

I am quite new to Xcode coding and I have been using Storyboard for along time, if you know when you link a button to a view and select the option "Modal" it will make a link with the animation of the new view coming up from the bottom. I was wondering if it was possible to change the animation to the new view coming from the right. I am sorry this question was so brief, if you need more info just ask me.
Thanks.
If you select the segue and look at the Attributes Inspector (on the right side of the window), you will see a pop-up menu labeled Transition. This menu lists the available transition styles for the segue:
Cover Vertical
Flip Horizontal
Cross Dissolve
Partial Curl
If you want a different style of transition, you will need to use a different type of segue. If you have a UINavigationController hosting your source view controller (the one that contains the button), you can use a Push segue, which slides the new view in from the right. If you don't have a navigation controller or don't like the Push segue animation, you'll have to implement a custom segue to change the animation.
More on custom segues
Custom Segue- Apple
Custom Segue + CATransition
-anoop

Resources