标签: tableviewcell

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万
查看次数

分组的UITableview删除外部分隔线

我有一个分组的UITableview,它是以编程方式创建的.此外,我还有一个以编程方式填充tableview的xib文件的单元格.到现在为止还挺好.但我想只删除外部分隔线.我使用下面的代码,但这次删除了所有分隔线.

self.tableView.separatorColor = [UIColor clearColor];

这对我的情况来说不是一个好选择.这是我想要做的截图;

在此输入图像描述

objective-c cell uitableview tableviewcell ios

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

使用DatePicker扩展和折叠UITableViewCells

我正在构建一个应用程序,让用户从UITableView中选择日期.tableView是静态的并且是分组的.我已经查看了许多问题,包括这个问题,试图弄清楚如何实现这一目标 - 但似乎没有什么工作是最佳的.Apple的日历应用程序具有非常流畅和漂亮的动画,我所经历的所有示例都没有设法重新创建.

这是我想要的结果:

就地日期选择器

有人可以指点我一个教程或解释我如何用最简洁直接的方式完成这样一个流畅的动画,就像我们在日历应用程序中看到的那样?

非常感谢!

埃里克

objective-c datepicker uitableview tableviewcell ios

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

如何使用按钮标签在swift中访问自定义单元格的内容?

我有一个应用程序,在自定义单元格中有自定义按钮.如果您选择单元格,它将转移到详细视图,这是完美的.如果我在单元格中选择一个按钮,下面的代码会将单元格索引打印到控制台中.

我需要访问所选单元格的内容(使用按钮)并将它们添加到数组或字典中.我是新手,因此很难找到如何访问单元格的内容.我尝试使用didselectrowatindexpath,但我不知道如何强制索引是标记的索引...

所以基本上,如果有3个单元格中有'Dog','Cat','Bird'作为每个单元格中的cell.repeatLabel.text,我选择第1行和第3行(索引0和2)中的按钮,它应该将'Dog'和'Bird'添加到数组/字典中.

    // MARK: - Table View

override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    return 1
}

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return postsCollection.count
}

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

    let cell: CustomCell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! CustomCell

    // Configure the cell...
    var currentRepeat = postsCollection[indexPath.row]
    cell.repeatLabel?.text = currentRepeat.product
    cell.repeatCount?.text = "Repeat: " + String(currentRepeat.currentrepeat) + " of " + String(currentRepeat.totalrepeat)

    cell.accessoryType = UITableViewCellAccessoryType.DetailDisclosureButton

    cell.checkButton.tag = indexPath.row;

    cell.checkButton.addTarget(self, …
Run Code Online (Sandbox Code Playgroud)

tags uibutton uitableview tableviewcell swift

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

TableView Cell视频自动播放

我做了什么: -

我已经添加了在单元格完全可见时播放视频的代码,当我向下或向上滚动时,它会再次重新加载tableview并再次播放视频.但是,我的要求是不同的.

我真正想要的是:

我想播放视频,直到完全可见的向后或向前的单元格.当用户向下滚动或向上滚动时,它不会影响直到完全可见的向后或向前单元格.

设计

Table Cell Layout Description
-> Video Table Cell (Fix height 393) 
    -> Content View
    -> Main view - (as per Content view of Table view Cell)
        -> Title View (0, 0, MainView.width, 57)
        -> Video View (0, 57, MainView.width, 200);
        -> Description View (0, 257, MainView.width, 136) 
Run Code Online (Sandbox Code Playgroud)

编码:

VideoTableCell.h

#import <UIKit/UIKit.h>

#import <AVFoundation/AVFoundation.h>



@interface VideoTableCell : UITableViewCell

@property (strong, nonatomic) IBOutlet UIView *viewForVideo;

@property (strong, nonatomic) IBOutlet UIImageView *imgThumb;

@property (strong, nonatomic) IBOutlet UIButton …
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview uiscrollview tableviewcell ios

18
推荐指数
2
解决办法
6466
查看次数

没有重用表单元格的索引路径

这开始发生了.任何想法:代码:

CUSTOMCLASSNAME(我已经替换了实际的类名,因为它包含客户端的名称.)

初始化我的tableView:

[self.tableView registerClass:[CUSTOMCLASSNAME class] forCellReuseIdentifier:[self reuseIdentifier]];
Run Code Online (Sandbox Code Playgroud)

在行的单元格中:

嗨,标题正在控制台中打印.这是我的cellForRow:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    AVTCheckListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[self reuseIdentifier] forIndexPath:indexPath];

    [self configureCell:cell atIndexPath:indexPath];

    return cell;
}

- (void)configureCell:(AVTCheckListTableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath {
    ChecklistGroup *group = [self.checklistFetchedResultsController.fetchedObjects objectAtIndex:indexPath.section];

    ChecklistItem *item = [self getChecklistItemForIndexPath:indexPath];

    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    [[cell cellTextView] setAttributedText:[[item checked] boolValue] ? [[NSAttributedString alloc] initWithString:[item name] attributes:@{ NSStrikethroughStyleAttributeName : @(NSUnderlineStyleSingle) } ] : [[NSAttributedString alloc] initWithString:[item name]]];
    [[cell cellTextView] setUserInteractionEnabled:[[group isUserDefined] boolValue]];
    [[cell cellTextView] setTag:indexPath.row];
    [[cell cellTextView] setDelegate:self]; …
Run Code Online (Sandbox Code Playgroud)

reusability tableview tableviewcell ios

16
推荐指数
4
解决办法
2万
查看次数

如何同时更新每个自定义tableview单元格数据?

我正在使用Xcode 8.2.1和Swift 3.我有一个包含UITextView的自定义UITableViewCell.当我输入时textView,自定义单元格会自动增长.这部分工作正常.当我输入特定单元格时,我还想用相同的数据更新我的其他单元格.例如:

当我在第5个单元格中键入文本时,会自动在第11,15和18个单元格中输入相同的数据.这些细胞也必须自动生长.我已经将数据添加到数组的特定索引中.但它没有反映在tableView.我如何实现此功能?

请仔细阅读我迄今为止实施的以下代码.此updateCellHeight方法是自定义委托方法.当用户键入时调用此方法textView.

func updateCellHeight(indexPath: IndexPath, comment: String) {

    let currentCellLyricVal = self.traduzioneArray[indexPath.row]["rics"]
    tempIndexArray.removeAll()

    for (index,element) in traduzioneArray.enumerated() {

        let lyricVal = element["rics"]
        if currentCellLyricVal == lyricVal {
            tempIndexArray.append(index)
        }
    }
    for index in tempIndexArray {
        self.traduzioneArray[index]["ione"] = comment
        self.lyricsTableView.beginUpdates()
        self.lyricsTableView.endUpdates()
    }
}

func textViewDidChange(_ textView: UITextView) {
    self.delegate.updateCellHeight(indexPath: self.cellIndexPath, comment: textView.text)
}
Run Code Online (Sandbox Code Playgroud)

iphone uitableview tableviewcell ios swift

14
推荐指数
1
解决办法
2530
查看次数

UITableView编辑动画持续时间

有没有人知道动画有多长

- (void)setEditing:(BOOL)editing animated:(BOOL)animated;
Run Code Online (Sandbox Code Playgroud)

UITableViewCell拿?我用0.5秒进行测试,但我更喜欢使用Framework中的常量UITableViewCellEditingAnimationDuration

uikit tableview uiviewanimation tableviewcell ios

13
推荐指数
2
解决办法
3179
查看次数

如何根据运行时系统iOS版本覆盖方法?

我已经使用iOS实现了iOS 8的自动动态tableview单元格高度

self.tableView.rowHeight = UITableViewAutomaticDimension;
Run Code Online (Sandbox Code Playgroud)

对于不支持自动动态单元格高度的iOS 8之前的版本,我重写了heightForRowAtIndexPath方法.

这与我的做法类似:在UITableView中使用自动布局进行动态单元布局和可变行高

问题是如何编写使用iOS 8自动单元格高度的代码,但是为早期iOS版本覆盖heightForRowAtIndexPath.仅当iOS版本小于8时,我才会喜欢我的自定义heightForRowAtIndexPath方法.有关如何执行此操作的任何建议吗?

tableview tableviewcell ios ios8

12
推荐指数
1
解决办法
1275
查看次数

在单元格内设置视角半径的问题?

我有一个自定义单元UITableView格.我设置它的左下角和右下角半径.我正在设置角半径cellForAtindexPath.Below是代码

  if indexPath.row == 9 {

    recipeInfoCell.outerView.roundCorners(corners: [.bottomLeft, .bottomRight], radius: 10)
    recipeInfoCell.layoutSubviews()
    recipeInfoCell.layoutIfNeeded()
  }
  else  {

    recipeInfoCell.outerView.roundCorners(corners: [.bottomLeft, .bottomRight], radius: 0)
    recipeInfoCell.layoutSubviews()


  }
Run Code Online (Sandbox Code Playgroud)

现在,当我第一次启动tableview时,它没有设置任何角半径.但是当我再次滚动时,它正在设置角半径.

我创建了一个扩展,UIView其中有一个功能是设置角半径

  func roundCorners(corners:UIRectCorner, radius: CGFloat) {

    let path = UIBezierPath(roundedRect: self.bounds, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
    let mask = CAShapeLayer()
    mask.path = path.cgPath
    self.layer.mask = mask
  }
Run Code Online (Sandbox Code Playgroud)

请告诉我该如何解决这个问题?

cornerradius uitableview tableviewcell ios

12
推荐指数
3
解决办法
2627
查看次数