I can't change the colour of my navigation bar to transparent. All the other view controllers in my project are fine, only this one. This particular view controller has a scroll view and it is presented by Segue.view
I use the following code in viewDidLoad()
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.isTranslucent = true
This is the identity inspector for the view controller
I found the solution. My background image was inside my View. I put it in the wrong place. see below for correct way
Related
I have started learning swiftUI so I have question about Navigation View. My app starts with splash screen which is embedded in Navigation View and after that I have navigation link to the second screen which is Tab View. Do I need navigation views in child views of Tab View if I have some button etc and I also need to go to other screens from them or I use primary navigation view which tab view is embedded in?
When using both TabView and NavigationView, TabView should always be the parent view and should contain NavigationView inside it.
Hope this clarifies what you’re looking for?
What is the name of the SwiftUI View shown in the image (the side popup view on the top right of the screen)? If it's custom made, then what default SwiftUI view do I use to achieve this look in my own app?
I want to embed some SwiftUI in my UIKit-based UI, and unfortunately Apple doesn't provide UIHostingView, only UIHostingController. Can I more or less ignore that controller and just use its view, or do I really need to add it as a child view controller as well? What happens if I don't?
The problem is that finding the parent view controller can be difficult in some contexts. UIView itself doesn't know anything about view controllers, so I'd have to come up with my own way of keeping track of which is the "current" view controller. And I'd rather not do that unless it's actually necessary.
So far in my experiments it's working fine without adding UIHostingController as a child. Device rotation is handled appropriately, and SwiftUI's dark mode override (.colorScheme()) even works through the embedding.
With UIHostingController(rootView:) you just pass in a SwiftUI View.
You can treat it as a UIView by doing:
let myView = UIHostingController(rootView: Text("Hello world!")).view
And then add it as a subview for example:
let parent = UIView()
parent.addSubview(myView)
I am presenting a viewController with transparent background. But the components on that viewController is invisible when it is presented. A blank viewController is seen.I have given alpha value and black background color.
This is my code when i call the transparent viewController
if indexPath.row==0
{
let modalViewController = PopUpViewController()
modalViewController.modalPresentationStyle = .overCurrentContext
present(modalViewController, animated: true, completion: nil)
}
But there is a orange color UIView present on this Controller which is invisible Thanks in advance
You just have to present your second Viewcontroller, which has a transparent background, modally. with the following config:
and that's the result :
for those who may not familiar with Opacity: in the situation like this, for transparency, it's better to use Opacity instead of Alpha
You can take two view one as outerView (Transparent black) and innerView( OrangeView) , note that both view are in same hierarchy. (as in screen shot)
Default View of viewController background color should be clearColor.
OuterView should having transparent black background.
On Segue presentation property in Attribute inspector of Segue should be Over Full Screen as shown in image.
it will show on running.
when I launch another UITabBarController in a LaunchView, the TTLauncherView is in the page in the original UITabBarController, the Dest Controller is another UITabBarController, but the Original UITabBarController's TabBar can't disappear.
So, in the UI, I have two TabBars, the Original TabBar in the Bottom, the second Dest Controller View display in the screen except the bottom tabbar.
This is not what I want. How to solve this problem to hide the Original TabBar and let the second Dest Controller to display Full Screen?
In the first Controller, I launch second controller by LauncherView button.
You need to hide the tab bar view when pushing the new controller using
controller.hidesBottomBarWhenPushed = YES;
Take a look on this tutorial from three20 wiki, it explains on how to hide the tab bar when pushing another controller.
http://three20.info/article/2010-11-10-Hiding-The-iphone-Tab-Bar-With-TTNavigator