iOS:UICollectionViewCell ContentView子视图总是算一个

时间:2016-02-19 06:47:45

标签: ios uicollectionviewcell subview

如何在$mandrill = new Mandrill("KEY_CODE"); $message = array( 'subject' => $_POST['mass_email_subject'], 'from_email' => 'noreply@test.com', 'to' => array( array( 'email' => $user->user_email ) ) ); $template_name = 'Test_Email'; $template_content = array( array( 'name' => 'email-content', 'content' => $_POST['mass_email_content'] // '<a href = "http://test.com/">Test</a>' ) ); $mandrill->messages->sendTemplate( $template_name, $template_content, $message ); 内添加动态视图,但当我滚动UICollectionViewCell时,视图已删除并添加最后一个单元格索引。 现在我在所有Appear单元格上添加了视图。

2 个答案:

答案 0 :(得分:0)

您应该在cellForItemAtIndexPath()添加/删除子视图。

也就是说,您每次都应该removeAllSubviews()然后cell.addSubview(yourSubview)

答案 1 :(得分:0)

尝试添加此

cell.contentView.removeAllSubviews()
cell.contentView.addSubview(yourSubview)

愿这对你有所帮助 让我知道它是否有效。