Got a bit of a weird one.
I am using the following codebase to build a UItable with AutoLayout programmatically:
Using Auto Layout in UITableView for dynamic cell layouts & variable row heights
The issue I have is that the output seems to give me the separator shifted to the right I need the background to be the background colour you see, but that little "notch" still remains white. I have changed the separator colour to black here for better viewing.
Any ideas on what is creating that would be much appreciated.
in viewDidLoad method set:
self.tableView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
note, that this method available from iOS 7
Related
I have a UITableView that is showing some strange thin grey lines next to the accessory view. This ONLY happens on the plus, no other iPhone shows this issue.
It seems to have something to do with the imageView that is assigned to the cell. Some images cause the line, others don't, seemingly based on their dimensions.
Has anyone else seen this or know how to get rid of it?
I experienced this when using a UITableView that was partially covered with an SWRevealViewController.
When the calculated value of the tableview width was a decimal number, artifact lines between the content of a UITableViewCell and the accessory view would appear.
The solution was to make sure that size calculations for the view were rounded to whole numbers.
It looks like that line is from the right edge of the cell's content view. I don't know how it works, but my solution was:
cell.backgroundColor = .clear
I'm having a similar problem to this question: UITableViewCell separator not showing up.
However, the proposed solutions don't work for me. Specifically, I've checked the following:
My UITableViewCell subclass does not override drawRect:.
I don't have a custom UITableView and, therefore, I'm not overriding layoutSubviews.
In Interface Builder, I have the Separator attribute of the Table View set to "Single Line".
I've tried programmatically setting tableView.separatorStyle to UITableViewCellSeparatorStyleSingleLine.
But still the separator line will now show up… Does anyone know of something else that could cause this behavior or have any ideas for how I might track down what is hiding/removing the separator line?
EDIT:
Well I feel silly… In trying to create the screenshot requested by valheru, I noticed that the lines ARE there, but are almost exactly the same color as the background, so I couldn't see them until the screenshot was blown up. I had suspected earlier that the separator color might be the issue, and I tried testing for that by setting the separator color to white (my background is almost black), but it turns out that there was some copy/pasted code that was programmatically resetting the color to the almost-invisible color.
Thanks valheru for leading me to the answer. :-)
Check the height of your table view's row and the height of the cell. Make sure that the row's height is not less than the cell's height.
In iOS 6, my login tableview that consisted of two rows (Username and Password) was completely shown correctly. In iOS 7, the bottom row is cut off, and I don't know why or how to correct the issue. Nothing changed except for upgrading to Xcode 5 and running on the iOS 7 simulator.
UPDATE: adding more images
try playing with navigationBar.translucent property in your view controller. in iOS 6 it is NO by default, but YES in iOS 7. I had a similar issue and this fixed it for me.
Just check your UITableView frame in iOS7, may be you are running it on 3.5 inch view and it will shrink.
Looking at the provided image, I think you may be underlapping the nav bar. Or to put it another way, your nav bar is on top of hte table. Though I'm not sure why that would cut off the bottom of the login information
I've found that simply changing from GROUPED to PLAIN table view style fixes the "underlap" issue with the section #0 header, but modifies the color of the section header views. I set the tableview background color in my app. With PLAIN style, the section header background color is messed up. The section header color is close to the tableview background color, but slightly modified. This does NOT happen if I simply switch back to GROUPED. It sounds like an iOS7 bug or an Xcode bug.
The translucent = NO fixed it for some cases. In others, I ended up adjusting the tableView in viewDidLoad
- (void)viewDidLoad
{
[super viewDidLoad];
CGRect f = self.tableView.frame;
f.origin.y += self.navigationController.navigationBar.frame.size.height;
f.size.height -= self.navigationController.navigationBar.frame.size.height;
self.tableView.frame = f;
}
This is obviously some kind of issue with the grouped table view style. All I had to to was go into the storyboard scene, select the table view, then in the attributes inspector change the style from grouped to plain. It works as intended now without being cut off.
I'm trying to reproduce the design of Twitter UITableView (see image below) :
Did not manage to reproduce it :(
I tried several methods like :
UITableViewController with self.view.layer.borderWidth = 3.0f + shadows + cornerRadius
UITableViewController with Grouped style and corner Radius
UIView with UITableView as a subview and corner radius
Any clue to solve my problem please ?
In advance, thanks a lot for your help.
In my opinion, this seems to be NOT your classic grouped style UITableView.
This could be a UITableView (plain style) that spans across the whole device width, and composed by custom UITableViewCell's. The cells are narrow enough to leave room for the scroll indicators to be shown.
Each UITableViewCell renders a UIImage on the cell's background: each different, depending on position - top, middle, bottom - or content type. The image for the cell background would already contain the shadow pixels. In an experience of mine, using Quartz for shadow, is too processor intensive and slow, iphone 4). In addition, each custom cell could also have its view setOpaque:TRUE for enhanced performance (against the solid colored background).
Each tweet cell may span different lines/heights so you'd probably use [UIColor colorWithPatternImage:[UIImage imageNamed:#"tile.png"]] when setting the background of the cell.
So we end up with no real shadow / processor intensive stuff. Just graphics, color matching and positioning.
This very similar to twitter UI
https://github.com/vicpenap/PrettyKit
I have used a simple trick wherein you use a UIView "Vbg" under UITableView and set the colour of cells and Table to clearcolor. Then increase the height:
Vbg.heightConstraint.constant = number of cells * height of cell.
I had to use this for fixed height cells , so this trick came up my mind and it worked pretty well.
I'm trying to create UITableView with vertical gridlines, using method described here: http://www.iphonedevx.com/?p=153 . Everything works fine, until I switch table style to grouped.
Vertical lines just don't appear on the table, though overridden drawRect: is still called.
What am I doing wrong? Is there some major difference between cells for grouped and plain UITableView? Is it possible at all to draw primitives on the cells for grouped tables?
Thanks in advance.
PS: I'm using XCode 4, iOS SDK 4.3 and running the project with iPhone 4.3 simulator.
Just looking for the same. Found this guy's blog. It looks promising. He uses a custom png with the grid to complete the effect.
OK, I've found a solution myself.
I've subclassed UILabel, which represents a single cell in a grid. Override of drawRect: draws path with rounded corners and fills it with desired color. Background color of a label is set to clear color, otherwise no rounded corners for me.
Then I've subclassed a UITableViewCell that adds labels to itself. To simulate margins it adds offsets to labels' frame.origin.x and frame.origin.y.
All this stuff contained in a plain UITableView, but with margins and rounded corners it looks like a grouped one.