开发者

strange border of grouped UITableViewCell

开发者 https://www.devze.com 2023-02-13 04:30 出处:网络
I\'m having problem with the border on grouped UITableViewCell, see the screenshot the upper border above \"add to contacts\" is thicker as the lower border as you can see. when man clicks on it, i

I'm having problem with the border on grouped UITableViewCell, see the screenshot

strange border of grouped UITableViewCell

the upper border above "add to contacts" is thicker as the lower border as you can see. when man clicks on it, it becomes the same as the lower border. Can anyone tell me how i can make the upper always the same as the lower?

above the cell "add to contacts" is another cell with height 0 and i tried the code

            for(UIView* v in cell.subviews)
                [v removeFromSuperview];

and

cell.backgroundView.hidden=TRUE;

but both don't work, the thicker border remains! all开发者_开发技巧 I did to the cell was first to

UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault 
                                                reuseIdentifier: nil ] autorelease];

and

[cell setSelectionStyle:UITableViewCellSelectionStyleNone];

and add some labels/images to it. so can anyone give me some hints? Thank you!

updated: why is there a line for cell with height 0?

strange border of grouped UITableViewCell


It's because your table view's separator style is UITableViewSeparatorStyleLineEtched, which creates that double-width border effect at the top. Change it to UITableViewSeparatorStyleSingleLine.

As to that mysterious line at the top, giving it a height of 0 will still cause a border to be drawn (for reasons beyond me). If you don't need the cell at the top then you should just omit the cell altogether, by telling tableView:numberOfRowsInSection: to return 2 instead of 3.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号