How do you replicate a cell such as the one sin the Contacts detail view? The have a "prefix" static text in blue followed (on the same line) by an editable text in black.
They are just using a custom tableviewcell with a blue label for prefix, black label for text and a custom background image. The background image will be different depending on where it is located in a group:
only cell in a group (rounded top and bottom)
first cell in a multi-cell group (rounded on top, flat on
bottom)
middle cell in a mult-cell group (flat on top and bottom)
last cell in a multi-cell group (rounded on bottom, flat on top)
Related
Is it possible to give a WatchKit table cell or WKInterfaceGroup a border width of 2px and a red border color? If not, are there any work-arounds?
It can't be done programmatically, but you can give the impression of a boarder in IB.
Add a separator above and below the cell's sub-group.
Give the cell's main group a background color.
Make the first separator an alpha of 0 and a top vertical alignment.
Give the cell's sub-group a center vertical alignment.
Give the second separator an alpha of 0 and a bottom vertical alignment.
I'm pleased with the result.
I would like to draw a line after every group as depicted with red line in the image.
Your report appears to have a dark line under each TOTAL cell in the Effective Date column? In your report designer, just select the long table cell to the right of that one and add in a border on the bottom of the cell.
Highlight the total row, expand BorderColor in the Properties window and select the color Red for the bottom border.
I have a UITableViewCell nib that depending on the data it can show an image or not.
Below, the cell has 2 labels and at the right most the imageView. What I want to do is to remove the imageView (if no image is present on the data) and extend the Label all the way to the right.
Is there a way to have several constraint scenarios on the nib that I could activate/ deactivate?
Constraints on label1
leading, 2. center vertically in container, 3. fixed width
Constraints on label2
Leading space with label1, 2. Center vertically in Container
Constraints on imageview
Trailing space, 2. Top space, 3. Bottom space,
Width constraint : width <= 50 (When there is no image then width will automatically get zero),
Horizontal space between
label2 and imageview = 0 (priority = 250)
See the below GIF:
How to design this table view cell..
Cell overlaps the another cell.
Please help me
Set the y offset of the pictureImageview to be negative i.e -50.0f or so, the image will appear as starting from the cell above.
I just tried AppleDelegate's solution but didn't work, because the top of every image is cut, maybe because it is beyond the cells bounds, even with clear color for background.
A different approach would be to believe that it's just a visual effect, and cells are not overlapping. This is possible by giving a different height for every cell with next code :
- (CGFloat)tableView : (UITableView *) tableView
heightForRowAtIndexPath : (NSIndexPath *) indexPath {
// RETURN A DIFFERENT HEIGHT FOR EVERY CELL DEPENDING ON INDEXPATH,
// INCREASING IT GRADUALLY.
}
In the next image, the black lines look like cells' top border, but maybe that's the effect, and the real limit is the red line :
Thinking this way, only the first cell requires a special treatment for the green titles.
Try setting constraints in storyboard and then keep the UIImageView's size/frame of image same when the image is set to UIImageView. Good Luck!
I have a UITableView with style: "Grouped"
By default, the iOS gives me rounded cells, with a white background and a grey separator.
How can I configure the table so that, for only one section of cells, the cells are rectangular (no border radius) and have no separator? - I wish to use a custom background image on these cells.
Thanks in advance -
bo
You can make them squared off by creating a dummy cell for the first and last cell and setting the row height to 0 for those cells in tableView:heightForRowAtIndexPath:.
You can set the seperator to None and clearColor in the inspector section of the storyboard in order to get rid of the seperators.
Then you can just create a custom background image using backgroundView for the cell in your cellForRowAtIndexPath::
UIImageView *customImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"yourimage.png"];
[theCell setBackgroundView:customImage];
You can use two kinds of UITableViewCell in the table, original for the standard cells and customized subclass with overridden drawRect to draw the other cells depending on indexPath.