
我不想要左边的配件视图的红色圆圈出现.
进入编辑模式后,我需要它将内容视图左移&显示我的删除按钮.
我到目前为止(定制UItableVIEwCell)覆盖:
-(voID) setEditing:(BOol)editing animated:(BOol)animated{ /* don't call super */// [super setEditing:editing animated:animated]; _isEditing = editing; CGfloat newContentVIEwX = 0.0f; UIcolor *newDeletebuttoncolor = [UIcolor clearcolor]; if ( _isEditing ) { newContentVIEwX = -40.0f; newDeletebuttoncolor = [UIcolor redcolor]; } if ( animated ) { [UIVIEw animateWithDuration:0.5f delay:0.0f options:UIVIEwAnimationoptionCurveEaseInOut animations:^ { self.contentVIEw.x = newContentVIEwX; //change frame.origin.x _deletebutton.backgroundcolor = newDeletebuttoncolor; } completion:nil]; } else { self.contentVIEw.x = newContentVIEwX; //change frame.origin.x _deletebutton.backgroundcolor = newDeletebuttoncolor; }}-(BOol) editing{ return _isEditing;} &安培;这是结果:
以上代码非常好!直到开始滚动& contentvIEw被重置.回到第一个图像.编辑标志不会持久化我的内容视图框架更改.
我已经添加了这一行:
[cell setEditing:_tableVIEw.isEditing animated:NO];
在cellForRowAtIndexPath&虽然它正在呼叫&正确设置编辑模式我的内容视图仍然处于原始位置&没有更新
短视频解说问题:
Youtube link
有人有这个问题吗?
解决方法 您的问题是,UItableVIEw是“有帮助”的设置适当的状态布局与您从cellForRowAtIndexPath返回的单元格.解决这个问题的最简单的方法是在你的单元格类中重写–layoutSubvIEws.
- (voID)layoutSubvIEws{ if (self.editing) { CGRect bounds = self.bounds; // do your custom layout } else [super layoutSubvIEws];} 这应该得到很多分类的东西.
总结以上是内存溢出为你收集整理的ios – UITableViewCell自定义编辑视图全部内容,希望文章能够帮你解决ios – UITableViewCell自定义编辑视图所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)