Swift, iPhone simulator strange grey cover over tableView - uitableview

I have no experience with ObjectiveC, I am practising swift programming, my program works with no error.
In my detail View Controller I have added tableview and a tableview cell
When I run I check there is data come back but there is a strange grey cover over my table view as shown in following screenshot, I have tried remove table view and even View Controller it still come back. What I possibly done wrong or this is bug of beta version? I am using beta 5

below the code clear the tableview background color check attachment for example enter image description here
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
tableView.backgroundColor = [UIColor clearColor];
}

Related

iOS Tables - same code different colors on iPad vs iPhone

I have a very strange situation where it appears my coloring doesn't "stick" for iPad where as it does for iPhone.
Iphone
Ipad
Everything is done in storyboards - so I'm very confused as to why this is occurring. Has anybody seen an issue like it before?
I cant seem to get rid of the white table rows in the iPad - its very annoying.
This is the old bug with UITableViewCell on the iPad.
Just use
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
[cell setBackgroundColor:[UIColor clearColor]];
}

Changing background of UITableViewCells in Edit Mode

I have trouble with a black table view appearing white when swiping left to delete (in my case void) a row.
I tried setting every possible parameter for color in every step all the way from the ViewController down to the Content of the TableViewCell.
I managed to get it darkGray for "selection" with the following in CellForRowAtIndex:
UIView *bgColorView = [[UIView alloc] init];
bgColorView.backgroundColor = [UIColor darkGrayColor];
[cell setSelectedBackgroundView:bgColorView];
So I figure the solution is something like that.
I have a similar setup on iPhone where the TableView is in a TableViewController where the issue does not occur. In this particular situation the TableView is in a regular ViewController.
Screenshots attached. Please advise. Edit: Note that the white space is not a button that appears next to the Void-button. It's white space that changes size according to how far your drag the cell. If you release the cell the white space disappears entirely, but the bounce reveals the white space.
Swiped left (in motion):
Swiped left (released):
Unswiped:
Wow - it turns out I only needed to implement the following method:
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
cell.backgroundColor = [UIColor blackColor];
}
Ironically I searched high and low for a solution, only to find it 15 minutes after I ask. It's been bugging me for weeks.
Ah, well, maybe someone else stumbles across this problem.

iOS 8 UITableView background color appearance

Xcode 6 beta 6, trying to change all UITableView's background colours in appearance proxy:
[[UITableView appearance] setBackgroundColor:[UIColor redColor]]
But seems that it doesn't work.
Steps to reproduce:
1 Create single view project
2 Add UITableView to ViewController in storyboard
3 Set delegates to view controller and change background in IB:
4 Add dynamic cell and configure data source:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 2;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:#"Cell1Identifier" forIndexPath:indexPath];
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 60.f;
}
5 In app delegate:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[[UITableView appearance] setBackgroundColor:[UIColor redColor]];
return YES;
}
6 Run app and watch incorrect colour:
Any suggestions how to fix it?
Setting background color for every table doesn't look like good solution.
try to "reset" the BackgroundColor to "Default" in the InterfaceBuilder (even if its already Default, you'll see a little color change)
this doesn't works with grouped style tableviews
UPDATE:
this worked for me
[[UIScrollView appearance] setBackgroundColor:[UIColor redColor]];
Clear color for TableViewCell not working in Tablet in XCode 6. The following workaround solve for me.
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
cell.backgroundColor = [UIColor redColor];
}
It appears that for iOS 8, at least for our circumstances, when we set a view's background color with a table in that view, we have to explicitly set the table and cell background colors to Clear in order for the desired color from the view to show. I suppose, with prior iOS versions, the cells were defaulted to transparent but that seems no longer the case.
Set cell background color to transparent in
tableView:willDisplayCell:forRowAtIndexPath:
[UITableVIew backgroundColor] is not marked with UI_APPEARANCE_SELECTOR. Appearance proxies will only work if selector is marked with UI_APPEARANCE_SELECTOR.
It seems that the appearance proxy exhibits a seemingly unreported bug in iOS 8.0.x; it's unrelated to the iOS 7 change involving the default background colour of table cells.
The relative good news is that this only seems to be an issue between iOS 8.0 and 8.0.2, because:
My iPhone 4S on 7.1.2 doesn't have this issue,
My colleague's iPhone 6 running 8.1 doesn't have this issue.
Until most users have upgraded you will have to set the background explicitly on the object itself, sending us back into the pre-appearance era :(

UITableView - transparent background in iOS 7

I am checking my app with ios 7 beta. I have set background color of UITableView to clear color. Its still showing white background.
Is there any other way around to make it transparant?
I couldn't make it work but the following worked perfectly :
-(void)tableView:(UITableView *)tableView
willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
[cell setBackgroundColor:[UIColor clearColor]];
}
Setting tableview backgroundColor to clear color working absolutely fine in iOS 7 chk screenshot see those separator lines for the table cells while the tableview is transparent.
Believe it or not, the following statement, added to cellForRowAtIndexPath, will cause iOS 7 to honor the XIB-specified color:
cell.backgroundColor = cell.backgroundColor;
In my XCode 5 Storyboard I had to set the background color of the 'View' section on the Table View properties to clear as well.

How to set color in empty UITableViewCell?

I want to replicate Gowalla UI of the detail part (the table with Map & Directions) picture below
I replicate it with a table with a contentInset, set backgroundColor to clearColor, and change color of UITableViewCell in - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath to white, but the result
isn't what I expected the empty cells are white only the cells with content (a number return by - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section ) here is a result I got
Is there any way to set empty cell color or any guide on how to achieve this ?
Set background color of view same as you are setting for your cell. and make cell transparent.
Due to no response for long time I would posted my solution here. I solved this problem by having UITableView under UIView and set parent view background color the same as UITableViewCell color.

Resources