- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
搜索没有给我任何关于这个问题的信息,所以我决定提出一个问题并提供一些代码。我需要将 UILabel 添加到 TableView 单元格。这是启动单元:
UITableViewCell *cell =[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellId];
然后,根据其他一些参数,其中一个单元格应包含 uiswitch 和 uilabel:
titleText = @"Some title";
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = @"dd.MM.yyyy - HH:mm";
detailText = [formatter stringFromDate:_someDate];
UISwitch *reminderSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(200, 5, 60, 20)];
IF_IOS6
reminderSwitch.frameX = 175;
reminderSwitch.on = NO;
[reminderSwitch addTarget:self action:@selector(reminderSwitchValueChanged:) forControlEvents:UIControlEventValueChanged];
[reminderSwitch setOnTintColor:[UIColor colorWithRed:78/255.0 green:169.0/255.0 blue:224/255.0 alpha:1.0]];
if (/*Some Condition*/)
{
UILabel *detail = [[UILabel alloc] initWithFrame:CGRectMake(100, 45, 150, 12)];
IF_IOS6
detail.frame = CGRectMake(0, 0, 100, 20);
detail.text = detailText;
detail.font = cell.detailTextLabel.font;
detail.textColor = cell.detailTextLabel.textColor;
detail.hidden = NO;
[cell addSubview:detail];
}
detailText = nil;
[cell addSubview:reminderSwitch];
}
此代码在 IOS7 中运行良好。此代码在 IOS6 中不起作用。请告诉我我在哪里犯了错误。提前谢谢你。
附言我只是无法为这种单元格创建一个新类。并且类似的代码(几乎相同)在使用相同类型的 UITableViewCell 的其他一些 Controller 的 IOS6 中运行良好。
最佳答案
改变
detail.font = cell.detailTextLabel.font;
至
detail.font = [UIFont boldSystemFontOfSize:18];
在 iOS6 上,单元格的文本标签的字体大小为 0 px
关于ios - 无法在 IOS6 中将 UILable 添加到 UITableViewCell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21673678/
前言 对应一个曾经开发 Android 的人来说,没有这些基础属性简直令人发指,还是表喷这个,认真写代码 - - # 正文 &n
我有一个表格 View ,每行使用一个自定义单元格。每个单元格/行我有 3 个标签。 3 个标签中的第一个标签包含一个数字(天)。每行都是相同的。问题是某些标签在下一行包含相同的值,我想要实现的是,如
我是 swift 新手,当我尝试构建应用程序时遇到了一些问题。当我尝试将值从 View A 传递到 View B(但应用程序将首先访问 View B)时,B 的标签将不会显示。但是,如果我从 View
考虑以下情况,我将段落数据发送到需要放置在背景图像上的 View ,该图像在顶部和底部具有固定元素(图 1) 图 1。 我的想法是将它分成 4 个标签 (Fig1.example2) 我的问题是如何让
我需要在文本中插入一个光标..我不需要文本字段(用户不要在其中输入)..我只需要光标本身。所以我可以手动把它放在任何我想要的地方..就像按钮的标题一样。或 UILabel .. 我试着在字符之间输入“
我正在从一个 json 文件中接收图像、标题和描述,我需要在 View 中显示它。我正在使用 webview,因为 description 属性有链接并且是 html 格式,所以 webview 是最
UILable 拖入 UIView 框架不在 UIImageView 框架我正在使用以下代码为拖动标签使用 UIPanGestureRecognizer UIPanGestureRecognizer
搜索没有给我任何关于这个问题的信息,所以我决定提出一个问题并提供一些代码。我需要将 UILabel 添加到 TableView 单元格。这是启动单元: UITableViewCell *cell =[
在我的应用程序中,我有一个 UITableView。表中的每一行包含 4 个 UIImages 和 4 个 UILabels,图像大小约为每张图像 50k。在大约 10 行之后,该表似乎有点滞后。我知
我是一名优秀的程序员,十分优秀!