tableView background image hides activity indicator - ios

I'm setting the backgroundView of a tableView like this:
self.tableView.backgroundView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:#"background"]];
It works but gets placed on top of the tableview's activity indicator and hides it when the tableview is pulled down for refresh. I've tried setting a breakpoint on the point it's added and confirmed that indeed it goes on top of the activity indicator subviews array. Is there any way to fix this?
Thanks in advance.

I suggest that is better to place UIImageView below your UITableView and set:
_yourTableView.backgroundColor = [UIColor clearColor];

Related

Why is the background of my table view grey when there are no rows?

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];

setting Transparency to the UITableView

I have a view that contains a scroll view and again that contains a view and then a table view.(this table view has custom cells).
I have a background image for the top most view but the inner most table view background is blocking the image. Tableview shows a white background .
I have to make the background of tableview as transparent so that the image on the view should be visible.
how to do that. Pls help.
Try:
tableView.backgroundView = nil;
tablecell.contentview.backgroundcolor = [UIColor clearColor];
Hope it should help..
You have to set the backgroundview nil before making background as transparent
tableView.backgroundView = nil;
tableView.backgroundColor=[UIColor clearColor];

UITableView FooterView background color to clear color doesnt work

i try to set the UITableView Footerview backgroundcolor to clearColor but it stays white, any
other color works fine, any ideas?
_footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, _incredientsTable.frame.size.width, 60)];
[_footerView setBackgroundColor:[UIColor clearColor]];
Thanks.
Ask yourself these questions:
What do you expect to see through the footer view? Is it the table's background? The underlying view controller's views? In the latter case there are more views between your and the object that you want to be visible under the footer view. That is at least the UITable itself and probably the background of self.view (which in most cases but not all is the table)
You need to set background color of table view in this case.
tblView.backgroundColor = [UIColor clearColor];

Setting image to tableview background

I have added an imageview on top of tableview. I need to set it to the back of tableview without setting it as a background on tableview.
sendSubviewToBack:bgView also does not work. Can someone help?
try like this ,
if objects are in xib ,then take imageview infront of tableview in xib,
(or)
if you are adding in programatically then add imageview before adding the tableview
(or)
table.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:#""]];
(or)
[table bringSubviewToFront:yourImageview];
Try this
self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"table_bg_image.png"]];
Not getting what exactly you want .
One another way from XIB , just simply add it into the xib behind your table View , and set your tableView's background colour as clearcolor, So you'll be able to see the image behind your tableview.

How to scroll UITableView background view when scroll the table

I know the UItableView have a property named:backgroundView, but this view not scroll with the table, I want add a background after the table, and can scroll .
How can I do that.
Thanks very much.
You have to set the background image via backgroundColor property of UITableView:
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"background.png"]];

Resources