iOS - pushViewController without sliding Background Image - ios

Messing around with pushViewcontroller due to one of the awkward requirement :/
So there is a rootViewcontroller with 1 Background Image and UITableView with custom cells and there is a detailViewController with similar backgruound image with different views.
Requirement is:
On tap of UITableViewCell... the whole navigation animation should not affect the background image. Background Image should stay as it is and all other view should slide.
How I can slide only UITableView and display detail screen without changing background image ?
There is one possible solution is just add 2 child view controller and apply slide animation on both child. But in that case I have to keep on removing the child. I can't remove child because on tap of custom bottom back button I have to display the 1st screen instantly.
Any other possible solution or improvement ?

You can wrap your UINavigationController in a custom view controller that contains the background image. Then make sure your content view, as well as the pushed controller's views have a clear background.

Related

UIViewController transparent background colour

I'm trying to achieve the following behavioural attached in the image and I did it using vies with custom classes, the question is that how can I achieve this using view controllers,
the behavioural works as follow: when tapped and swipe left the previous screen should start appear but without pop from navStack, just slide to show and when user leave his finger will return to initial state which same as above image, I did it by adding a UIGestureRecognizer on this white slide edge start change the x position for the upper view but, both upper and previous are views not UIViewColtrollers, the question is how to implement this using UIView controllers or make the background colour of the upper view controller transition colour.
have any idea about this or do sth like this before to help ?

Swift ios: drag view controller onto screen

Is there any way to drag a view controller onto the current view controller using Swift? I would like to drag from the bottom of the screen and have the new view controller follow the finger. When the finger releases, I want for the view to snap into place. The view controller that I plan to drag on needs to have a transparent background so that the previous view is still visible. I tried using a swipe gesture paired with an animation that brings in the view from the bottom, but the previous view turns black momentarily before the animation is complete. Also, it doesn't follow the finger's path. This is similar to what happens when you try drag from the bottom of the camera app. It brings up a page, following your finger, and darkening the background. I am doing this programmatically. Thanks.
To do this you will need to use a UIPageViewController and set its transition style to scroll and navigation to vertical. There are lot's of great tutorials on how to use a UIPageViewController so just look online.

Slide in/out child view controller partially visible on parent view controller in Swift

I have built two separate UIViewControllers: MainVC and 2ndVC. Now I am trying to connect them and achieve the effect presented on the image below:
When loaded, 2ndVC should be visible partially on top of MainVC (let's say 1/4 of the screen). On swipe up 2ndVC should cover whole screen and on swipe down it should go back to starting point. I have some buttons on MainVC which I would like to stay active when 2ndVC does not cover whole screen.
2ndVC's height will change dynamically dependently on data. It has scrollview inside which should be active only when it covers whole screen.
What is the best way to do that? Should 2ndVC be embedded in container view as a child view controller? Should I somehow animate constraints of 2ndVC programmatically on swipe?
Probably a Container View Controller is what you are looking for:
https://developer.apple.com/library/content/featuredarticles/ViewControllerPGforiPhoneOS/ImplementingaContainerViewController.html

Add a UIImageView to the back of NavigationBar (NOT background image)

I am trying to add a UIImageView to the back of a navigation bar.
The reason is because I want to create a UITableView whose navigation bar is actually a picture (with back button on the left) but I want the picture to scroll with the tableview and when the picture is fully scrolled out. The navigation bar is shown as per normal.
My solution to this problem:
Add a UIImageView to the top of the UITableView and make the navigation bar transparent. Set a contentOffset for the UITableView which is a subclass of UIScrollView so that when the view is presented, it looks like the picture is filling the navigation status bar.
Problem:
If I scroll up, instead of bouncing back, the transparent status bar is shown (with a color of the background as it is transparent).
Possible way to solve this new problem:
I was thinking of trying to limit the ScrollView size to get around with problem but failed.
So I feel is it possible to add the UIImageView to the "back" of the navigation bar so that it is there without any offset? Since that way, my life will be much easier.
Any suggestions on solving this or another new approach to get the same UI/effect?
Related question.
I would do this by adding either a table header or cell at the top of the table which contains your image.
Create the table view so that it extends all the way to the top of the screen. Extend Under Top Bars option. I have not done this with a UITableViewController but I have done this with a UITableView embedded inside a UIViewController's view with the top constraint set to 0 for the view rather than the top layout guide.
Now when you run this your table will fill the whole screen and the top header or cell will be at the top showing your picture.
When you scroll you can either use the UIScrollViewDelegate to detect the movement or implement tableView:didEndDisplayingCell:forRowAtIndexPath:
I'm not 100% sure when you want the navigation bar to go non clear. If its when the image goes off screen then didEndDisplayingCell should be good. If its when the cell bottom passed under the bottom of the navigation bar then scroll view might be your only option.
This will also bounce as you expect when you pull down and it should snap back to the top.
Hope this helps.

How to make a view controller appear from the left and to not fill the full view?

How to make a UiViewController appear from the right of the screen, the same way as this application(Break) does on iPad.
https://itunes.apple.com/us/app/funny-videos-pics-by-break.com/id342257973?mt=8
In fact, I would like that my UIViewController appears on the screen from a side and not to fill the entire UIView of my main ui view controller. The background view should also be darken.
To sum up, I would like to mimic the same Break's behavior.
Here is a picture if needed
Any idea ? Thanks for your time !
You may need to just do some manual work with UIViews. So rather than push a viewcontroller onto the stack you would overlay a semi transparent black view over your background view to darken it and then simply do an addSubView of the view you want to show on top.

Resources