I just want a simple UITableView with the ability to slide left to delete. Everything works okay except the right constraint on the textview in my prototype cell seems to get shifted after swiping to delete. Here's my code for the table:
public string TestSiteStatus()
{
getSiteStatus site = new getSiteStatus();
site.site = "XXX";
string res = "";
using (SiteServiceImplService service = new SiteServiceImplService())
{
res = service.getSiteStatus(site);
}
return res;
}
This is what it looks like after I've swiped left to edit and then swiped back right on the top cell (stackoverflow won't let me use pictures yet). Note the right sides of the gray text boxes and labels in each cell are no longer aligned. The gray text box in the cells has a right constraint of -8 so I'm also confused why there's any margin on the other cell's text boxes at all.
Thanks for any help you can give me, I'm still fairly new to Swift! I've tried to find anything like this question on stack overflow and I've come up empty.
答案 0 :(得分:2)
好的,所以我找到了解决这个问题的方法,并认为我会在这里发布,以防其他人遇到同样的问题。
对我来说,它似乎仍然是XCode中的一个错误,因为我无法想到你可能想要上述行为的任何时候。基本上,如果原型单元格中的文本框约束设置为"约束边距"在Pin自动布局菜单中,在您滑动删除然后向后滑动后,右边的水平约束将被随机重置(据我所知)。
添加这些约束时,只需取消选中约束边距即可解决此问题!