Hi I am attempting to create a rectangular region (tableView), that when it has no cells will be just a background color. Then when it has cells, the cell background can be different and separators become visible. This idea can be seen in http://itunes.apple.com/us/app/spendings/id473857206?mt=8
in the second screen shot. I can come close by just setting the background color of the table and the cells to different colors, but when there are no cells the table collapses. The screenshot in that link doesn't show this, but when there are no items, it is just an empty rectangle. How can one maintain the dimensions of the table, even when there are no cells?
You can try setting the separator color to clearColor so that the cells aren't visible when they're empty, like:
if([tableView numberOfRowsInSection:0]==0)
{
tableView.separatorColor = [UIColor clearColor];
}
Related
I attempted to use UITableView (with static content) to create a setting screen similar to the iPhone's system setting screen. It mostly works excepts the blank space under the last row are filled with white row cells instead of background color, as shown in this screenshot:
I have tried various ways to fix this: setting the table view's background, add an empty row as the last row with the background color. What should be the right fix?
Objective-C
[[UITableView alloc] initWithStyle: UITableViewStyleGrouped]
Swift 2
UITableView(style: .Grouped)
Swift 3
UITableView(style: .grouped)
You should also be able to set the table view style in the interface builder.
You need:
tableView.tableFooterView = UIView()
How to remove empty cells in UITableView?
Eliminate extra separators below UITableView
Go to View Section of the TableView's Attributes Inspector and set the background color there. It will work
I have collectionview grid, Now I want to add a UIView on collectionview across full view as show in attached image with yellow color. Blue color column is fixed. I have to drag drop that strip view to in any row. Please, let me know approach.
You don't add views to existing cells. That's not how collection views work. You should tell the collection view to reload the cells in question. You can reload the entire collection view, certain sections, or individual cells (by indexPath)
What you show is a background color, not an image. I suggest changing the background color of the cells that you want to appear yellow rather than adding a new view to those cells. Just remember that your cellForItemAtIndexPath data source method will need to set the background color of EVERY cell, not just those cells that you want to be yellow or cyan (blue as you call it, but that color is cyan, not blue).
I want to create spacing between table view cells like this:
I have 1 section and a dynamic number of rows per section for my tableview. So far I have set my content view to clear like this in my tableView:cellForRowAtIndexPath: method:
cell.contentView.backgroundColor = [UIColor clearColor];
I have also created a view within my content view, but I'm not sure how to set those values or manipulate the subview so that it appears as though there is spacing. If there's an easier way to create spacing I'm open to those suggestions as well.
Set the group background to clear color and the controller's background to the color you want.
1) Set the tableviews background colour to clear.
2) Set the cells background colour to clear as well.
3) Add a view(suppose "myView") with the background colour you need on top of the cell such that the height of the view is less than the rows height (e.g. myView.height = 90 and row height is 100).
4) Add the rest of your views as subviews of myView.
You will achieve your desired result.
I have a UITableView on a UIView. This UIView is in a UICollectionViewCell which means that I can do the action you can see in the image. A new UICollectionViewCell is coming on from the right. As a new cell comes onto the visible rect it is slightly resized you can see that the right one is slightly smaller.
While this new cell is "sliding on" the table view has some black lines that show through. It is not the actual separator lines as you can clearly see them, further turning them off or making them the same colour as the cell does not change things.
So can anyone tell me what these black lines are and if I can either directly get rid of them or cover them over somehow.
I believe that the lines are cell separators. You could set the separatorStyle property to UITableViewCellSeparatorStyleNone.
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
is it possible to make a table look like messages on iPhone. So that maybe each message is a table section with an image of a bubble and on top of that bubble is a label with the message text. Can a table cell be entirely transparent so that only the bubble image is displayed without the white cell, and the border?
Thanks
Have a look at this :
UIBubbleTableView
If you want the growing textView where you type the message, this is the one :
HPGrowingTextView
When you create your cell you can make the background transparant:
cell.contentView.backgroundColor = [UIColor clearColor];
You can simply add an imageView as backgroundView.