I have a UISearchDisplayController that goes black after erasing search-text.
These pictures explain my issue:
Add an a to the searchbar
Removes the a from the searchbar
I tried these settings in ViewDidLoad, but it's not working.
self.searchDisplayController.searchResultsTableView.backgroundColor = [UIColor clearColor];
self.searchDisplayController.searchResultsTableView.backgroundColor = [UIColor clearColor];
Actually the searchResultsTableView is not shown when the search bar is empty. Instead a semi transparent view is shown so that you can see the underlying view (usually the view of the VC that invokes the search). In your case I guess the underlying view is black so it doesn't matter that the search view is semi transparent :)
Setting its background to white color should do the trick.
Related
I have an AVPlayerController and have shifted it up 100px. The background of the video is solid white and the background in the app is solid white. Yet there's a weird flickering on the edge when it scrolls.
You can see the border right above the signup button and at the edge of the cell. I even tried putting a second view above it with a white stroke to hide it, and it just shifted it in more. The fact it's not a single color and instead flickers is super strange to me.
Any ideas how to fix it?
Video -
https://drive.google.com/file/d/1kBK92teYIm29_tAMFpMizdAMAVw8CknV/view?usp=sharing
As a quick solution, you can make screenshot of the video and put it on overlay view of the AVPlayerViewController while scrolling.
Edited: You can try to set overlay property as UIView with white background color and see if the gap is gone. It may looks like that:
UIView *overlay = [[UIView alloc] initWithFrame:self.myPlayerVC.bounds];
overlay.backgroundColor = [UIColor whiteColor];
self.myPlayerVC.contentOverlayView = overlay;
Why is the background of my table view grey when there are no rows? I can't see where this is set in storyboard
Even setting the background to white explicitly I still get a grey background
Using the defaults for background also results in this grey background:
this might be due to two reason
a) you haven't set data source and delegate and your main view background color is gray
b) cell background color is gray, set that to clear color
Please add this code viewdidload or viewwillappear method
table.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
For me it looks like it is a problem of the UITableViewCells, you should set them to
self.backgroundColor = [UIColor whiteColor]; // or clearColor
then also set the UITableView itself inside the controller to backgroundColor white or grey.
Also the snippet of #Rohitsuvagiya can help to let dissappear the separators if there is no additional UITableViewCell.
Please add line your code in viewdidload or viewillappear
table.backgroundColor=[UIColor clearColor];
i want to change my application background change. My view name is topNavVw for change my application background color i used this code
topNavVw.backgroundColor = [UIColor blackColor];
but it's not working .
Thanks in advance
You have to call
self.view.backgroundColor = [UIColor blackColor];
in viewDidLoad, in the Controller class that you want to appear black.
If you want a specific view/button/label to have a black background then it is the same,
myView.backgroundColor = [UIColor blackColor];
If it still doesn't work, use the view hierarchy debug (the button just before the arrow on the bottom of the screen, in the separation of the debug screen and code screen). There you will be able to see all your views and maybe you'll notice that your black view is behind another view that is not black.
I would like my status bar to be black and be 25% transparent. I understand that the status bar is transparent by default, and therefore takes on the color of the background. However when I set the views backgroundColor:
self.view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:.75f];
The status bar is completely black.
I have a toolbar which I set to black with an alpha of .75 and I am just trying to get them to match:
self.toolBar.tintColor = [UIColor whiteColor];
self.toolBar.barTintColor = [UIColor blackColor];
self.toolBar.alpha = .75f;
Any reason why the background color on the UIView is not respecting the alpha component?
EDIT:
Based on comment that view does not underlap the status bar. If I set background to green it shows that it works:
However if I start to add transparency to the green color, it does not get lighter it gets darker. Seems like the default is to be black underneath my only UIView, not white.
self.view.backgroundColor = [[UIColor greenColor] colorWithAlphaComponent:.25];
The status bar in iOS 7 is completely transparent. The problem may be that your view and the toolbar are not correctly underlapping the status bar. So you are seeing the black window behind it. (Or, in fact, you may setting the size of the window incorrectly, in which case you are seeing nothing at all behind the status bar.)
If the view does underlap the status bar, then you need to set the bar positioning of the toolbar to Top Attached so that its height increases up underneath the status bar. We should not be seeing a separate color for the status bar; it should appear to overlay your interface, lying in front of the top of the toolbar.
I have a view which has two containers: Top_Container and Bottom_Container.
Each Container points to a VC with a TableView.
The Bottom_Container points to a TableView with a searchBar on top.
Whenever the searchBar gets activated in the TableView a white space appears below the searchBar between the searchBar and the greyed zone corresponding to the serachBarTableView (which superposes the TableView).
I have been trying with no success to get rid of this white space with no success.
Anybody has an idea how to customize:
- the white space which appears below the searchBar ?
- the greyed zone (searchBar TableView ?) on top of the TableView which appears whenever the searchBar gets active ?
Thank you.
Try with following code:
CGRect rect = self.searchBar.frame;
UIView *lineView = [[UIView alloc]initWithFrame:CGRectMake(0, rect.size.height-2,rect.size.width, 2)];
lineView.backgroundColor = [UIColor clearColor];
[self.searchBar addSubview:lineView];
It is fix.
I had similar problem and in my case it was caused by opaque NavigationBar. When I set NavigationBar to translucent, then the underlaying UITableView is correctly aligned to the active UISearchBar. (note: I'm using UISearchDisplayController in my view controller)
In your case maybe you can move (and animate) the underlaying table view in UISearchDisplayDelegate's methods willBeginSearch and willEndSearch. If you are using UISearchBar only, then you need to subclass it and override becomeFirstResponder and resignFirstResponder methods and implement the "table view moving" code there.
I just fixed this problem in my own code. For me, the issue was caused by 2 lines of code.
self.viewController.edgesForExtendedLayout = UIRectEdgeNone;
self.navigationBar.translucent = NO;
After removing both these lines, everything worked as expected.