我可以调整UITableview
分隔线的高度吗?我在单元格中添加了UIView
作为分隔线,它的优点是,问题是当我滑动单元格以删除它时,删除按钮就是问题,它与分隔线重叠,还是可以调整删除按钮的高度?UItableview分隔线的高度
0
A
回答
0
如果您无法调整删除按钮的大小,请调整您的底部UIView
,以便它可以重叠删除按钮。
0
我总是吸引分隔线像细胞的内容查看一个子视图。并禁用tableView中的separatorStyle。和自定义删除按钮喜欢这里:https://stackoverflow.com/a/22396248/887325
0
在你TableViewCell layoutSubviews
方法写:
if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationControl"]) {
UIView *deleteButtonView = (UIView *)[subview.subviews objectAtIndex:0];
CGRect newf = deleteButtonView.frame;
newf.origin.x = 250;
newf.origin.y = 47;
newf.size.width = 30;
newf.size.height = 50;
deleteButtonView.frame = newf;
}
希望这有助于.. :)
1
由拉沙德粘贴的代码将是很老的(发现here ),并似乎并不适用于iOS 7或iOS工作8
这里被更新的代码工作:
-(void)layoutSubviews {
UIView *deleteButtonView = nil;
for (UIView *subview in self.subviews) {
// find the delete view in iOS 8
if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationView"]){
deleteButtonView = subview;
break;
}
// find the delete view in iOS 7
if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellScrollView"]) {
for (UIView *secondSubview in [subview subviews]) {
if ([NSStringFromClass([secondSubview class]) isEqualToString:@"UITableViewCellDeleteConfirmationView"]) {
deleteButtonView = secondSubview;
break;
}
}
}
}
int heightOffset = 5;
CGRect buttonFrame = deleteButtonView.frame;
buttonFrame.origin.y = heightOffset;
buttonFrame.size.height = self.frame.size.height-2*heightOffset;
deleteButtonView.frame = buttonFrame;
}
相关问题
- 1. UITableView分隔线
- 2. UITableView上的分隔线
- 3. UITableView高度的部分
- 4. 分隔符是否有助于UITableView的总高度?
- 5. 如何更改UITableView Swift 3中的分隔符高度?
- 6. 的iOS的UITableView隐藏分隔线
- 7. 创建自定义的UITableView分隔线
- 8. 由虚线分隔的UITableView单元格
- 9. CSS自动分隔高度
- 10. UITableView行高度
- 11. 如何制作100%高度的列分隔线
- 12. 如何增加导航菜单分隔线的高度?
- 13. 增加UITableViewCell分隔符的高度
- 14. 动态改变listview的分隔高度?
- 15. 溢出内容的分隔高度
- 16. 设置NavigationView的列表分隔高度
- 17. 母分隔线之外的分隔线
- 18. 在TwoWayView Android库中设置分隔线高度
- 19. 拉伸分隔线和iframe到屏幕高度
- 20. UITableView模糊高度
- 21. UITableView加载高度
- 22. UITableView内容高度
- 23. UITableView中的分隔单元
- 24. %高度的线高度
- 25. UITableview的相对高度
- 26. UITableView单元格的高度
- 27. 的UITableView头动态高度
- 28. UITableView的动画高度
- 29. iOS更改uitableview的高度
- 30. UITableView分隔线样式“单线蚀刻”不能正常工作
我会稍后再试:) – MaappeaL 2014-09-25 05:15:43
我没有为我工作。 – MaappeaL 2014-09-25 06:53:09
ios 11中缺少UITableViewCellDeleteConfirmationControl – 2017-10-12 16:48:14