从回收的UITableViewCell中删除强属性(Removing strong property from recycled UITableViewCell)
我在我的viewcontroller中声明了一个属性,称为:
@property (nonatomic, strong) UISegmentedViewController *segmentedControl;
我有一个tableview,我通过这个将segmentedControl添加到第一个单元格:
self.segmentedControl.frame = CGRectMake(10, 10, cell.frame.size.width - 20, 30); self.segmentedControl.selectedSegmentIndex = self.segment; [cell addSubview:self.segmentedControl];
我只想在第一个视图中使用此控件,当然,当我将单元格出列时它会被回收。 如何从后续单元格中删除segmentedControl? 我无法调用[self.segmentedControl removeFromSuperView],因为这将从第一个单元格中删除它。
注意:我必须将其声明为属性,以便我可以从委托方法引用它。
I declare a property in my viewcontroller known as:
@property (nonatomic, strong) UISegmentedViewController *segmentedControl;
I have a tableview where I add the segmentedControl to the first cell via this:
self.segmentedControl.frame = CGRectMake(10, 10, cell.frame.size.width - 20, 30); self.segmentedControl.selectedSegmentIndex = self.segment; [cell addSubview:self.segmentedControl];
I only want this control in the first view, and naturally, it gets recycled as I dequeue cells. How do I remove the segmentedControl from the subsequent cells? I can't call [self.segmentedControl removeFromSuperView] as this will remove it from the first cell.
Note: I have to declare it as a property so I can reference it from the delegate method.
原文:
最满意答案
文件>设置>编辑器>检查> JavaScript>代码样式问题>取消选中'未终止的语句'。
您必须重新启动WebStorm。
您也可以在“默认设置”中执行此操作,因此这适用于任何未来的项目。
File > Settings > Editor > Inspections > JavaScript > Code Style Issues > uncheck 'Unterminated statement'.
You'll have to restart WebStorm.
You can also do this in 'Default Settings' so this applies to any future projects.
相关问答
更多-
Cookie没有标准的转义机制。 的; 例如,字符根本不能在cookie中使用; 与URL编码或HTML编码不同,没有任何方案允许直接从cookie中获取的字符代表分号。 所以人们倾向于做的是ad-hoc编码 - 他们用一些任意形式的编码对cookie进行编码,并在将其拉回后再次对其进行解码。 URL编码,这是encodeURIComponent()所做的,是最流行的ad-hoc编码方法,但仍然不能无条件地使用工具。 jQuery cookie插件采用这种形式的编码,并在cookie名称和值上为您调用enc ...
-
冒号在这里意味着什么?(What does the colon mean here?)[2023-06-19]
它看起来像TypeScript类型提示 。 这表明变量source可以是any类型。 It looks like a TypeScript typehint. This indicates that the variable source can be of any type. -
sqlite3_close文档清楚地说明了这一点: 在尝试关闭对象之前,应用程序必须完成所有预准备语句并关闭与sqlite3对象关联的所有BLOB句柄。 如果在仍具有未完成的预准备语句或BLOB句柄的数据库连接上调用sqlite3_close(),则返回SQLITE_BUSY。 The sqlite3_close documenation states it clearly: Applications must finalize all prepared statements and close all B ...
-
补救Python冒号错误(Remedial Python colon error)[2022-07-10]
这里有四个问题: 在if之后你需要一个空格。 否则,Python会看到if__name__ ,它将其视为一个单词。 这是导致错误的原因。 您需要缩进此下的行,以便不会出现IndentationError 。 您需要将maxArray的返回值maxArray变量,然后打印它。 否则,最后一行将抛出一个NameError表示max未定义。 您不应该将变量命名为max 。 这样做会掩盖内置功能 。 以下是您的代码的外观: #!/usr/bin/python # My Name hw 11 def maxArra ... -
你说你有一个比利时键盘 - 我猜它是一个注册的时期,应该有你描述的行为。 在Github上提出问题,这可能是一个错误。 https://github.com/microsoft/vscode You said you have a Belgian keyboard - my guess it that it's registering as a period, which should have the behavior you describe. File an issue on Github, it m ...
-
你有什么: ArrayList list = new ArrayList();;; //(with three `;` semi-colon) 不是以三个分号结束的声明。 这是一个由一个分号结束的声明,后面是两个空的声明 。 空语句在Java中是合法的,但Java源文件的导入部分不包含语句,它由导入声明组成。 JLS 14.6定义了空语句: 空语句什么都不做。 EmptyStatement: ; 执行空语句总是正常完成。 可能合法使用空语句: //loop forever while (t ...
-
在第561页的语言参考手册中这称为深度赋值运算符。 语法是destination:=:source。 Destination可以是GROUP,RECORD,QUEUE ds或数组的标签。 源可以是相同的加上数字,字符串const,变量,过程或表达式。 它将执行从一个ds到另一个ds的多个单独的组件变量赋值。 更多信息可以在该文档中找到,也可以找到明显的主页: http : //www.softvelocity.com/ Deep Assignment运算符的一个很好的例子: Group1 GROUP ...
-
文件>设置>编辑器>检查> JavaScript>代码样式问题>取消选中'未终止的语句'。 您必须重新启动WebStorm。 您也可以在“默认设置”中执行此操作,因此这适用于任何未来的项目。 File > Settings > Editor > Inspections > JavaScript > Code Style Issues > uncheck 'Unterminated statement'. You'll have to restart WebStorm. You can also do thi ...
-
"ajax:success"只是一个字符串,jQuery决定将其用作与AJAX请求完成相对应的名称。 它根本与对象文字无关; 它只是文字。 他们决定使用冒号的唯一原因是要明确它是成功的AJAX对象。 jQuery可以选择任何其他名称(例如: .on("ajax_success", , .on("ajaxwassuccessful",等),如果他们愿意的话。 它不是一个对象字面值,不是JSON,只是一个简单的旧字符串。 That "ajax:success" is just a string that jQu ...
-
冒号预期错误(Colon expected error)[2022-06-06]
这一行: with open some_obj.get_file_name() as f: 应该: with open(some_obj.get_file_name()) as f: 也就是说, open()是一个函数! This line: with open some_obj.get_file_name() as f: should be: with open(some_obj.get_file_name()) as f: That is, open() is a function!