首页 \ 问答 \ 从回收的UITableViewCell中删除强属性(Removing strong property from recycled UITableViewCell)

从回收的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.


原文:
更新时间:2021-08-26 07:08

最满意答案

文件>设置>编辑器>检查> 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 ...
  • 它看起来像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 ...
  • 这里有四个问题: 在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 ...
  • 这一行: 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!

相关文章

更多

最新问答

更多
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)
  • 是否可以嵌套hazelcast IMaps?(Is it possible to nest hazelcast IMaps? And whick side effects can I expect? Is it a good Idea anyway?)
  • UIViewAnimationOptionRepeat在两个动画之间暂停(UIViewAnimationOptionRepeat pausing in between two animations)
  • 在x-kendo-template中使用Razor查询(Using Razor query within x-kendo-template)
  • 在BeautifulSoup中替换文本而不转义(Replace text without escaping in BeautifulSoup)
  • 如何在存根或模拟不存在的方法时配置Rspec以引发错误?(How can I configure Rspec to raise error when stubbing or mocking non-existing methods?)
  • asp用javascript(asp with javascript)
  • “%()s”在sql查询中的含义是什么?(What does “%()s” means in sql query?)
  • 如何为其编辑的内容提供自定义UITableViewCell上下文?(How to give a custom UITableViewCell context of what it is editing?)
  • c ++十进制到二进制,然后使用操作,然后回到十进制(c++ Decimal to binary, then use operation, then back to decimal)
  • 以编程方式创建视频?(Create videos programmatically?)
  • 无法在BeautifulSoup中正确解析数据(Unable to parse data correctly in BeautifulSoup)
  • webform和mvc的区别 知乎
  • 如何使用wadl2java生成REST服务模板,其中POST / PUT方法具有参数?(How do you generate REST service template with wadl2java where POST/PUT methods have parameters?)
  • 我无法理解我的travis构建有什么问题(I am having trouble understanding what is wrong with my travis build)
  • iOS9 Scope Bar出现在Search Bar后面或旁边(iOS9 Scope Bar appears either behind or beside Search Bar)
  • 为什么开机慢上面还显示;Inetrnet,Explorer
  • 有关调用远程WCF服务的超时问题(Timeout Question about Invoking a Remote WCF Service)