开发基于 Swift 的血压记录应用
1. 配置表格单元格显示结果
为了让表格单元格能够显示血压记录结果,需要更新 cellForRow 函数。以下是更新后的代码:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell
let item = self.objects.objectAtIndex(indexPath.row) as BloodPressureItem
cell.textLabel!.text = String("\(item.pressureSystolic)/\(item.pressureDiastolic)")
return cell
}
这里只是简单地显示血压值,后续可根据需求使用数字格式化器和单位来优化显示。
2. 创建数据录入界面
2.1 创建视图控制器和关联视图
- 新建一个文件并添加到项目中,选择
iOS ➤ Source ➤ Cocoa Touch Class。 - 将父类设置为
U
超级会员免费看
订阅专栏 解锁全文
826

被折叠的 条评论
为什么被折叠?



