在带有按钮的自定义UITableViewCell上,文本有时会消失-iOS 7
我创建了一个自定义的在带有按钮的自定义UITableViewCell上,文本有时会消失-iOS 7,uitableview,xamarin.ios,ios7,Uitableview,Xamarin.ios,Ios7,我创建了一个自定义的UITableViewCell,其中有一个ui按钮。在iOS 6中,它始终按预期运行。在iOS 7中,第一次加载视图后,它看起来是正确的。但是在任何TableView.ReloadData()之后,该按钮上的文本将消失,直到我触摸该按钮并将其滑开以不触发单击事件 您可以在电影中看到所描述的行为: ButtonCellNew.cs 尝试删除按钮llnew类中的prepareforeuse方法 我在iOS 7上也有类似的问题,我完全删除了它。它的行为似乎有所改变,因为它是在从D
UITableViewCell
,其中有一个ui按钮
。在iOS 6中,它始终按预期运行。在iOS 7中,第一次加载视图后,它看起来是正确的。但是在任何TableView.ReloadData()
之后,该按钮上的文本将消失,直到我触摸该按钮并将其滑开以不触发单击事件
您可以在电影中看到所描述的行为:
ButtonCellNew.cs
尝试删除
按钮llnew
类中的prepareforeuse
方法
我在iOS 7上也有类似的问题,我完全删除了它。它的行为似乎有所改变,因为它是在从DequeueReusableCell
方法返回单元格之前被系统调用的。显然,“新”行为还包括在其他点调用该方法。或是虫子什么的
不管怎么说,这并不重要,因为苹果只建议使用它来重置与用户界面相关的属性,而不是与内容相关的属性
因此,你可以生活在没有:
Button.TitleLabel.Text = string.Empty;
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
else if (indexPath.Section == (int)SupportTableViewSection.Button && indexPath.Row == (int)SupportTableViewButtonRow.Close)
{
var cell = tableView.DequeueReusableCell("buttonCell") as ButtonCellNew;
if (cell == null)
cell = new ButtonCellNew("buttonCell");
cell.Button.SetTitle("Support Einstellungen schliessen", UIControlState.Normal);
cell.RegisterEvents();
cell.ButtonClickedAction = ExitSupportSettings;
return cell;
}
}
Button.TitleLabel.Text = string.Empty;