ios – UITableViewRowAction自定义样式?

ios – UITableViewRowAction自定义样式?,第1张

概述我想编辑我的表的UITableViewRowAction.我的单元格有圆角和边框,我想编辑RowAction的样式以匹配我的单元格样式. 据我所知,目前只能更改backgroundColor,title和style(默认,破坏性,正常……)(link).但是,我觉得这有点太受限制了?也许我可以继承UITableViewRowAction来创建我自己的外观和感觉?任何意见,将不胜感激. 不幸的是我无 我想编辑我的表的UItableVIEwRowAction.我的单元格有圆角和边框,我想编辑RowAction的样式以匹配我的单元格样式.

据我所知,目前只能更改backgroundcolor,Title和style(默认,破坏性,正常……)(link).但是,我觉得这有点太受限制了?也许我可以继承UItableVIEwRowAction来创建我自己的外观和感觉?任何意见,将不胜感激.

不幸的是我无法发布示例图像,因为我还没有10个代表(哈哈).但是我觉得这个问题很简单,没有视觉表现就能被理解.

解决方法 正如您所说,您可以在行动中改变的唯一事项是:

> backgroundcolor
>风格(破坏性(红色backgroundcolor,…)
>标题

为了改变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自定义样式?全部内容,希望文章能够帮你解决ios – UITableViewRowAction自定义样式?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1012408.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-22
下一篇2022-05-22

发表评论

登录后才能评论

评论列表(0条)

    保存