Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
780 views
in Technique[技术] by (71.8m points)

ios - Z Index of image and separator in UITableViewCell

I have a UITableViewCell that has an image that sits partly outside the cell. See attached.

enter image description here

However, the separator line is covering the image. Is there a way to get rid of that separator line? The best I found is turning off all the tableviewcell separators, but I don't want to do that since it messes with the UI. I'd like to be able to adjust the UIImageView z-index or the tableviewcell separator z-index.

I tried [self bringSubviewToFront:self.overflowImageView]; on the UITableViewCell but that doesn't change anything.

Even if I could change the width of the separator to 1px, I'd be okay with that, but it seems like you can't change the separators on top and or bottom of the tableview.

Anyone have ideas on how to get the image above the cell?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can change UIView layer z-order with using setZPosition. It is applied to all objects inherited from UIVIew. May be is it a bug, bringSubviewToFront not working for all cases as it suppose to.

[yourView.layer setZPosition:10];

Higher the number higher priority.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...