After a lot of research, i have to resign...
I'm working on Xcode7, and swift.
I have a transparent navigation bar, so when i'm scrolling on the viewcontroller (a map), i would like the back button be more visible, so with a white opaque background.
Any idea to perform that ?
Maybe, just to insert an image as back button.
In your main.storyboard file, click anywhere in the storyboard that is not a viewcontroller, so in the white space. Then in the file inspector, there is property Global Tint that will change the back bar text color. I've looked around for other ways to change it, such as changing the back buttons text color programmatically, and none seem to work. Hope that helps.
Related
I faced with the Table View Cells issue. If I choose default View Controller settings, cells are located under transparent navigation Bar. This is unacceptable because bars items overlap the cell.
navigation bar overload the tableView
If I changing Extend Edges setting at the tab on the right side, specifically "Under Top Bars", cells as expected are located under bar, but in this case NavigateBar is black.
navigation Bar is black
As you see I tried to fix that issue with the Simulated Metrics, but nothing is chanced. Also self.navigationController?.navigationBar.isTranslucent = true and self.navigationController?.view.backgroundColor = .clear in viewDidLoad method did't give any result. I able to color navigation Bar, but i need it transparent. Any ideas?
I guess you haven't set a background color to the ViewController's view. That's why it's appearing black.
Try adding the background color you want and it should work as expected.
I have a window controller with blue background color
The background color of all children view controllers work fine with blue background just like their parent window controller, except NSTabView of NSTabViewController, which draws with the original gray background
I am not sure why it does not inherit the background color, or why it is not transparent
Anyway, to solve the issue, I tried the following
(1)
I tried editing the CLayer background
tabView.layer?.backgroundColor = NSColor.blue.cgColor
I tried putting that code everywhere, and the only time it worked is when I accessed the CLayer from a tabViewItem inside its viewWillAppear function or viewDidAppear or viewWillLayout, but the problem is that this code does not work until I select another tab... i.e. when the tabViewController is shown at the beginning, the initial view background color is grey, and does not change to blue until I select another tab!
From my understanding, the tabView is drawn after its child viewDidAppear, that's why it overcame the blue color order, and when another tab is selected, the viewDidAppear function is called again changing the color to blue (since the tabView` is already drawn)
(2)
I tried to change drawsBackground value to false
when the tabviewcontroller is shown, the background is just like what its windows is, blue, but as soon as I choose another tab, black residue are left from the previous tabviewitem controls
any idea how to solve this problem is much appreciated!
I solved this by adding a Custom Box to the initial tab with the required background color, and resized it to the size of the view
In the rest of tab views, I added this line to viewWillAppear function
tabView.layer?.backgroundColor = NSColor.blue.cgColor
The custom box feels like a hack but is the only way around I could come up with
An alternative solution is to place a custom NSBox behind the NSTabView with the correct size and background color. No further code needed, as long as all tabs feature a transparent background.
I create a navigation tab bar on the bottom of iphone and use dark gray color as tint color. Every things is good except the upper half's color is a bit lighter than bottom half. I also didn't fix it by programmatically set background color and tint color in viewDidLoad. This problem happen both of simulator and my iphone 5
This effect was added by the system in the default way, not a bug or problem.
You can custom UITabBar in this way:
tabController.tabBar.backgroundImage = [UIImage imageNamed: #"TabBarBG"];
Not only reset the background color or tint color.Have a try.
That's the visual effect "gradient" added automatically by system. You can write a custom tab bar yourself to change the effect.
This is default behavior of tab bar.
However you may change this by setting bakgroundimage for tab bar.
I created two views that has its transition controlled by a navigation view controller. I have a UIView which contain a UISearchBar. The UIView is then set as the navigation bar's titleView in the first view.
Now, the problem is, whenever I go from the first view to the second view, I can see a light background behind the UISearchBar fading in and out.
I have did a bit of troubleshooting of my own and found that the background belongs to the UISearchBar and not the UIView that contains it. I have also tried many codes to make the UISearchBar background transparent, but none of the codes actually makes it transparent.
Edit: I did a bit more fiddling and found that the colour fading in and out is the colour from the style/tint of the UISearchBar. So if I change the tint to black, it'll darken instead. The only way I see I can fix this is to turn the background of the UISearchBar's alpha to 0, but I can't find any code that can change the alpha of a UISearchBar in a UINavigationBar.
Edit: I really can't find any code to turn the background tint of the UISearchBar to be alpha 0. Does anyone have a workaround or an alternative solution to this?
I realised that the bar is actually the scope bar's background. I'm not sure why it still showed up even though I disabled it. My solution was to set the background image as a transparent image.
[self.searchBar setScopeBarBackgroundImage:[UIImage imageNamed:#"transpixel.png"]];
How to make tableview's content displayed under a transparent navigation bar?
Like this:In "Photos" app, albums displayed under navigation bar.
Special thanks
If you use _rootNavigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent; then set correct tableview frame thats it. If you are in xib dont forget to simulate the translucent navigation bar.
One way I have found to accomplish this is by shifting your tableview's superview up to have the origin at {0, 0}. However after researching more several people have said altering the superview (UIViewControllerWrapperView) is a bad idea. However I also have not found any information on why just changing the frame would create problems. I am shifting the superview right now and haven't found any problems related to it yet.
Might be you can set it like this:
[navigationBar setAlpha:0.5f];
For making the navigation bar transparent alone, you can check this post, How to make a Navigation bar transparent and fade out like in the photo app in the iPhone
Also check this How to set the transparency color for Toolbar and Navigation bar using MonoTouch?
I am not sure whether you can add the table view behind the navigation bar. You might have to add it as a subview of self.parentViewController.view.
Another way to do this is by hiding navigation bar and using a transparent tool bar in place of that. This can be added on top of the current view. The only problem is with the back button. You might have to use custom button for that.