画一个圆角矩形

时间:2018-12-21 02:24:16

标签: ios swift

如何绘制一个如下所示的圆角矩形:

needed rectangle

有人知道如何实现吗?

1 个答案:

答案 0 :(得分:1)

只需执行所有步骤。

步骤1-像这样创建模型

class Teachers: Codable {
  var id: Int?
  var name: String?
  var position: String?
  var subj: Int?
  var depart: Int?
  var lect: Int?
  var pract: Int?
}

第2步:这样映射

  do {
        // Decode data to object
        let url = Bundle.main.url(forResource: "JSON_DATA_TEACHERS", withExtension: "json")
        let jsonData = try Data(contentsOf: url)
        self.teachers = try JSONDecoder().decode([Teachers].self, from: jsonData)
        self.tableView.reloadData()
      }catch {
                print("Json Mapping Error: " + error.localizedDescription)
      }