English 中文(简体)
用户可访问查看器视图是否对 UitableViewCell 使用过Appear
原标题:viewDidAppear for UITableViewCell

我通常使用 viewDidAppear 方法来做一些UI在显示完成后的一些UI材料,我在不同情况下也使用这种方法,如果有用的话,但是,在显示完成后,我需要对 UITableViewCell 做一些UI修改,SDK中是否有任何方法可以做类似的工作,如 viewDidAppear ,但对于 UITVell 则做类似的工作?

p. s. will DisplayCell /displayCell/displayCell> /code(如果真的存在的话) / code(如果真的存在的话) / displayCell/code(displayCell) /code(dcode) //ccode(dcode)/copleCell/code(dcode)/col.

问题回答

UITVEVEGE 具有以下功能:

func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath)

func tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath)

单元格本身对此没有回调 。

如果您需要响应单元格框架的更改并调整布局, 您需要在单元格类中执行 < code>- layoutSubview 。 记住要调用 < code> [超级布局Subview]

view didLoad 的方法与UIVoctor及其子分类有关,所以我们不能在UITableViewCell(UITViewCell)(UIViewVell)(UIViewCell)(UIViewVell)(UIViewVell的子分类)中使用这个方法。我在一个应用程序中使用的解决方案是推翻 UITViewCell (UITViewCell) 的layoutSubOview 方法,我将操作延迟了一段时间。

- (void)layoutSubViews
{
     [super layoutSubviews];

     [self performSelector:@selector(myMethod) withObject:nil afterDelay:1.0];
}

您可以使用 didmove toSuperview 并在那里更新您的单元格

override func didMoveToSuperview() {
    super.didMoveToSuperview()

    if superview != nil {
        // Update the cell
    }
}

如果您需要更快的东西,请使用 将会 DisplayCell

func tableView(_ tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
    // Update the cell
}




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签