为什么在UITableViewCell标识符中使用static关键字? [英] Why is the static keyword used in UITableViewCell identifiers?

查看:95
本文介绍了为什么在UITableViewCell标识符中使用static关键字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经多次阅读了静态"文章,包括在发布此问题之前. 我仍然在搜索"Aha".

I've read up on "static" on several occasions, including just before posting this question. I'm still searching for an "Aha" though.

在UITableView的静态上下文中,我所查看的每一段代码都出现在单元标识符"中.例如,在最近的CellForRowAtIndexPath中:

In the context of UITableView's static comes up in Cell Identifiers in every piece of code I've looked at. For example in a recent CellForRowAtIndexPath:

    static NSString *defaultIndentifier = @"Managed Object Cell Identifier";

我的问题是为什么我们需要并使用静态"?

My question is why do we need and use "static"?

推荐答案

因此它只会被构建一次.如果不是静态的,那么每次发送消息时都会发送一个消息(很多)

So that it will only be constructed once. If it's not static, you'll be making one every time the message is sent (which is a lot)

这篇关于为什么在UITableViewCell标识符中使用static关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆