开发者

how to slide UILabel in uitableviewcell when swipe to delete is used

开发者 https://www.devze.com 2023-04-04 15:12 出处:网络
I have a custom uitableview with a UILabel to the right of the cell as shown below I have enabled swipe to delete, but when the button appears the UILabel is covered, I am guessing this is because m

I have a custom uitableview with a UILabel to the right of the cell as shown below

how to slide UILabel in uitableviewcell when swipe to delete is used

I have enabled swipe to delete, but when the button appears the UILabel is covered, I am guessing this is because my custom tableviewcell has not been informed about the delete button..

how to slide UILabel in uitableviewcell when swipe to delete is used

I am wondering how I go about moving the UILabel to the开发者_运维问答 left of the delete button when the swipe is detected.


This is how you would do it if you create the cell in a xib. You create a view the same size as the cell and put all of your labels inside it. Create an outlet for this view. Then in the .m of the customCell you add the view to the contentView.

[[self contentView] addSubview:cellView];

Then, in the xib add struts so that the labels stick to the edge of whatever side they are nearest and you should be good to go!

0

精彩评论

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

关注公众号