摘要: alertWithTitle(title: "输入信息", message: "请输入您的姓名:", placeHolders: [], buttons: ["确定"], defaultButtonIndex: 0, cancelButtonIndex: 0, defaultText: "张三"); 阅读全文
posted @ 2023-09-18 17:13 临易 阅读(14) 评论(0) 推荐(0) 编辑
摘要: navigationController?.pushViewController(fileOperation, animated: true) 通过导航控制器(navigationController)将一个新的视图控制器(fileOperation)推入栈顶,同时以动画的形式展示这个过程。如果na 阅读全文
posted @ 2023-09-18 17:01 临易 阅读(13) 评论(0) 推荐(0) 编辑
摘要: tableView.deselectRow(at: indexPath, animated: true) 作用:在表视图(UITableView)中取消选中某一行。 在表格视图中,用户可以点击或轻击一行来选中它。如果你想要在程序中取消选中这一行,就可以使用deselectRow(at:indexPa 阅读全文
posted @ 2023-09-18 15:51 临易 阅读(28) 评论(0) 推荐(0) 编辑
摘要: func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { print(indexPath.row) } 作用:当选中此cell时需要执行的方法. 用于响应UITableView中某一行的选中事件。 阅读全文
posted @ 2023-09-18 15:44 临易 阅读(20) 评论(0) 推荐(0) 编辑
摘要: as 是强制类型转换运算符。使用它可以将一个对象的类型转换为另一种类型。如果类型转换失败,会触发一个运行时错误。as! 是强制类型转换运算符。使用它可以将一个对象的类型转换为另一种类型。如果类型转换失败,会触发一个运行时错误。它与 as 类似,但是它更加强烈地说明了类型转换是成功的。as? 是可选类 阅读全文
posted @ 2023-09-18 15:39 临易 阅读(25) 评论(0) 推荐(0) 编辑
摘要: tableView.dequeueReusableCell(withIdentifier: cellID, for: indexPath) 作用:复用cell.可以用标识符从表视图中获得可重用单元格.for: indexPath通过指定单元格位置获得可重用单元格,不需要判断. 用于 dequeue( 阅读全文
posted @ 2023-09-18 15:37 临易 阅读(60) 评论(0) 推荐(0) 编辑
摘要: func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cellid = "testCellID" //cell的ID var cell = tableV 阅读全文
posted @ 2023-09-18 15:21 临易 阅读(31) 评论(0) 推荐(0) 编辑
摘要: func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 6 } 返回一个整形. 作用: UITableView的DataSource,用来确定cell的个数.number 阅读全文
posted @ 2023-09-18 15:02 临易 阅读(27) 评论(0) 推荐(0) 编辑