- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我想编辑表格的 UITableViewRowAction
。我的单元格有圆边和边框,我想编辑 RowAction
的样式以匹配我的单元格的样式。
据我所知,目前只有 backgroundColor
、标题和样式(默认、破坏性、正常...)可以更改 ( link )。但是,我觉得这有点太受限制了?也许我可以子类化 UITableViewRowAction
来创建我自己的外观?任何建议将不胜感激。
很遗憾,我无法发布示例图片,因为我还没有 10 个代表(哈哈)。不过,我认为这个问题很简单,无需视觉表示也能理解。
最佳答案
正如您所说,您唯一可以更改的操作是:
为了更改 UITableViewRowAction 的样式,可能的解决方案是使用“patternimage”添加图像。
这是解决方案。我并不是说这是确切的解决方案,因为现在我们无法访问“UITableViewRowAction”的所有属性
- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewRowAction *moreAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"test" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
// show UIActionSheet
}];
float wwidth =[moreAction.title sizeWithAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"Helvetica" size:15.0]}].width;
wwidth = wwidth+<55 change this value for exact width>;
moreAction.backgroundColor = [[UIColor alloc] initWithPatternImage:[self imageWithImage:[UIImage imageNamed:@"temp.jpg"] scaledToSize:CGSizeMake(wwidth, tableView.rowHeight)]];
UITableViewRowAction *flagAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Flag" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
// flag the row
}];
flagAction.backgroundColor = [UIColor yellowColor];
return @[moreAction, flagAction];
}
注意:使用高分辨率图像,以便它适用于
iPhone 6 Plus 736x414 points 5.5"
iPhone 6 667x375 points 4.7"
iPhone 5 568x320 points 4.0"
iPhone 4 480x320 points 3.5"
此链接上的有用帖子 http://pablin.org/
关于ios - UITableViewRowAction 自定义样式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26907285/
我想让用户能够在我执行删除滑动操作时删除表格单元格,但我不知道如何实际删除所选单元格!如您所知,我正在使用 Swift 和 Xcode 6.3.1 编程 var deleteAction = UITa
我有下面的代码,它将处理 tableViewCell 中的右侧滑动,当用户在具有discussionURL的正确单元格上向右滑动时,如果用户在没有这个内容的单元格上向右滑动,它工作正常URL 然后 U
当 UITableViewRowAction 滑动发生时,与该操作关联的单元格背景会将其背景颜色更改为白色,而不是像通常那样的黑色。换句话说,您可以在单元格圆角半径后面看到的颜色随着滑动操作而变化。请
使用UITableViewRowAction非常棒。有件事让我烦恼,我想保留原始单元格 textLabel 的一部分,以便我亲爱的用户知道他们要删除的内容。 通过使用UITableViewRowAct
我用谷歌搜索了两个多小时,没有发现任何有用的东西:我有一个带有 editActions 的 tableView 。当我按下该操作时,我会显示一个包含附加信息/需要确认的警报 Controller 。
func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyO
我已经创建了自定义操作: public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndex
我在 中创建了一个 UITableViewRowAction 的实例 -(NSArray *)tableView:(UITableView *)tableView editActionsForRow
我正在使用 UITableViewRowAction iOS 8 Beta 2+ 中的方法在我的表格中的一行上滑动时添加自定义按钮。我不知道如何处理点击事件,它目前只是让我的应用程序崩溃了。我尝试了以
使用 UITableViewRowAction 可以在每一行上设置不同数量的按钮吗?例如,我希望一行包含 3 个操作,其余行包含 2 个操作。这可能吗? func tableView(tableVie
我的源代码中有 3 个 UITableViewRowAction 的,如下所示: - (NSArray *)tableView:(UITableView *)tableView
我想编辑表格的 UITableViewRowAction。我的单元格有圆边和边框,我想编辑 RowAction 的样式以匹配我的单元格的样式。 据我所知,目前只有 backgroundColor、标题
我想做一个像邮件应用一样的 cell 滑动 Action 。 我将 UIImage 设置为行操作的 backgroundColor。 action.backgroundColor = [UIColo
我有一个 UITableView,我使用 UITableViewDelegate 和 UITableViewDataSource 在 Controller 中进行管理。在此表中,我有一个自定义单元格,
那里有几个类似的问题,但我认为应该有一个最新的 iOS 10 答案,使用 Swift3,不使用私有(private) API,也不依赖于你限制你的图标到 unicode 表情符号。 我现在有包含三个操
我想在 Swift 的 tableviewCell 的滑动 Action 中放置图标(图像)而不是文本。 但我不知道如何用图片代替标题文字? 我的代码如下: func tableView(tableV
我有一个自定义的 UITableViewRowAction 设置和工作。我唯一无法解决的是如何在选择了一个 Action 后关闭 UITableViewRowAction。我确定我错过了一些非常明显的
我使用objective-c 编程iPhone App。版本在 iOS 8.1 之后。我的 UITableViewCell 中有一些 UITableViewRowAction,我在点击其中一个 UIT
这个问题已经有答案了: How to change UITableViewRowAction title color? (11 个回答) 已关闭 7 年前。 我想更改 UITableViewRowAc
我已经使用 UITableViewRowAction 创建了 UITableView:编辑和删除。当按下删除键时,确认应该显示为 UIAlertController。如果用户按删除,单元格应被删除,如
我是一名优秀的程序员,十分优秀!