相关疑难解决方法(0)

iOS 9中可滑动的表格视图单元格

我希望我的表格列表具有类似iOS 8中的可滑动菜单(首先在iOS 7中引入).

表视图单元格操作按钮的屏幕截图

我已经找到了Ray Wenderlich指南,该指南很清楚如何做,但它是在一年零四个月前编写的,代码是在Objective-C中.

iOS 8或即将推出的iOS 9最终是否在Apple的SDK中包含此功能?我知道他们在几年前内置了"轻扫显示删除功能".我不想浪费我的时间来实现修补代码来模仿iOS 8邮件功能,如果Apple的新iOS将以一个整齐的包裹交给我.

uitableview custom-cell tableviewcell swift ios9

80
推荐指数
5
解决办法
7万
查看次数

UITableViewRowAction标题为图像图标而不是文本

我想在Swift中的tableviewCell中的滑动操作中放置图标(图像)而不是文本.

但我不知道如何把图像而不是标题文字?

我的代码如下:

func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]?  {

    var shareAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Share" , handler: { (action:UITableViewRowAction!, indexPath:NSIndexPath!) -> Void in
        // 2
        let shareMenu = UIAlertController(title: nil, message: "Share using", preferredStyle: .ActionSheet)

        let twitterAction = UIAlertAction(title: "Twitter", style: UIAlertActionStyle.Default, handler: nil)
        let cancelAction = UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler: nil)

        shareMenu.addAction(twitterAction)
        shareMenu.addAction(cancelAction)


        self.presentViewController(shareMenu, animated: true, completion: nil)
    })
    // 3
    var rateAction =    (style: UITableViewRowActionStyle.Default, title: "rate",im , handler: { (action:UITableViewRowAction!, indexPath:NSIndexPath!) -> …
Run Code Online (Sandbox Code Playgroud)

uitableview ios swift

29
推荐指数
3
解决办法
3万
查看次数

如何在UITableViewRowAction中添加图像?

我正在尝试以UITableView滑动样式添加图像.我尝试使用Emoji文本及其工作正常

func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
  let editAction = UITableViewRowAction(style: .normal, title: "") { (rowAction, indexPath) in
      print("edit clicked")
  }

  return [editAction]
}
Run Code Online (Sandbox Code Playgroud)

但我需要图像而不是表情符号,同时我试过

editAction.backgroundColor = UIColor.init(patternImage: UIImage(named: "edit")!)
Run Code Online (Sandbox Code Playgroud)

但它正在获得重复的图像,我使用了许多格式的图像,如20*20,25*25,50*50,但仍然重复.

我该如何添加图片?

uitableview ios swift

11
推荐指数
2
解决办法
1万
查看次数

标签 统计

swift ×3

uitableview ×3

ios ×2

custom-cell ×1

ios9 ×1

tableviewcell ×1