2016年12月11日 星期日 晚
這周總結(jié)的較少攒暇,時間也比較緊施敢,希望大家見諒,但總結(jié)的都是比較重要的部分辐脖,希望有助于大家的學(xué)習(xí)和復(fù)習(xí)饲宛,下周一定會給大家一個更詳細(xì)的總結(jié),么么噠??
day15
微信界面
- 新建一個JNTViewController.swift繼承自UITabBarController嗜价,在其中進(jìn)行控制器的創(chuàng)建:
override func viewDidLoad() {
super.viewDidLoad()
let vc = ViewController() //創(chuàng)建控制器
self.addChildVC(vc: vc, title: "消息", image: UIImage(named: "tabbar_mainframe")!, selectImage: UIImage(named: "tabbar_mainframeHL")!.withRenderingMode(.alwaysOriginal))
let contact = ContactViewController()
self.addChildVC(vc: contact, title: "聯(lián)系人", image: UIImage(named: "tabbar_contacts")!, selectImage: UIImage(named: "tabbar_contactsHL")!.withRenderingMode(.alwaysOriginal))
let discover = DiscoverViewController()
self.addChildVC(vc: discover, title: "發(fā)現(xiàn)", image: UIImage(named: "tabbar_discover")!, selectImage: UIImage(named: "tabbar_discoverHL")!.withRenderingMode(.alwaysOriginal))
let I = IViewController()
self.addChildVC(vc: I, title: "我", image: #imageLiteral(resourceName: "tabbar_me.png"),selectImage: #imageLiteral(resourceName: "tabbar_meHL.png").withRenderingMode(.alwaysOriginal))
}
//1 控制器
//2 tabbar文字
//3 圖片
//4 選中圖片
func addChildVC(vc: UIViewController, title: String, image: UIImage, selectImage: UIImage) {
//設(shè)置導(dǎo)航控制器
let vcN = JNViewController(rootViewController: vc)
//把導(dǎo)航控制器設(shè)置為子控制器給tabbar管理
self.addChildViewController(vcN)
//設(shè)置文字艇抠、圖片
vcN.tabBarItem = UITabBarItem(title: title, image: image, selectedImage: selectImage)
let color = UIColor.init(colorLiteralRed: 40.0 / 255.0, green: 177.0 / 255.0, blue: 26.0 / 255.0, alpha: 1.0)
//修改文字
let dic = [NSFontAttributeName: UIFont.systemFont(ofSize: 12),NSForegroundColorAttributeName: color]
vcN.tabBarItem.setTitleTextAttributes(dic, for: .selected)
let dic1 = [NSFontAttributeName: UIFont.systemFont(ofSize: 12), NSForegroundColorAttributeName: UIColor.lightGray]
vcN.tabBarItem.setTitleTextAttributes(dic1, for: .normal)
self.addChildViewController(vcN)
}
- 新建一個JNViewController.swift繼承自UINavigationController,用來修改狀態(tài)欄的屬性:
override func viewDidLoad() {
super.viewDidLoad()
let color = UIColor.init(colorLiteralRed: 55.0 / 255.0, green: 53 / 255.0,blue: 60 / 255.0, alpha: 1.0)
self.navigationBar.barTintColor = color;
//修改狀態(tài)欄的顏色
let dic = [NSFontAttributeName: UIFont.boldSystemFont(ofSize: 20),NSForegroundColorAttributeName: UIColor.white]
self.navigationBar.titleTextAttributes = dic
}
可以把ViewController設(shè)置為微信下邊的第一個久锥,再分別新建微信的下邊另外三個ViewController练链,分別為:ContactViewController.swift繼承自UIViewController;DiscoverViewController.swift繼承自UIViewController奴拦,DiscoverTableViewCell.swift繼承自UITableViewCell媒鼓;IViewController.swift繼承自UIViewController,ITableViewCell.swift和I2TableViewCell.swift都繼承自UITableViewCell错妖;
-
在DiscoverViewController.swift中進(jìn)行“發(fā)現(xiàn)”的設(shè)置:
- 先創(chuàng)建一個類
class CellMode : NSObject {
var title : String? = nil
var image : String? = nil
}
-
DiscoverViewController要繼承UITableViewDelegate, UITableViewDataSource兩個協(xié)議绿鸣;
- 在DiscoverViewController中鍵入:
//放分組對應(yīng)的數(shù)據(jù)
var arr : [[CellMode]] = [[CellMode]]()
var tableView : UITableView? = nil
override func viewDidLoad() {
super.viewDidLoad()
self.title = "發(fā)現(xiàn)"
self.view.backgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
self.tableView = UITableView(frame: self.view.bounds, style: .grouped)
self.tableView?.delegate = self
self.tableView?.dataSource = self
self.view.addSubview(self.tableView!)
self.load()
//注冊
self.tableView?.register(DiscoverTableViewCell.self, forCellReuseIdentifier: "tag")
}
func load() {
let mode1 = CellMode()
mode1.title = "朋友圈"
mode1.image = "ff_IconShowAlbum"
let arr = [mode1]
let mode2 = CellMode()
mode2.title = "掃一掃"
mode2.image = "ff_IconQRCode"
let mode3 = CellMode()
mode3.title = "搖一搖"
mode3.image = "ff_IconShake"
let arr1 = [mode2, mode3]
let mode4 = CellMode()
mode4.title = "附近的人"
mode4.image = "ff_IconLocationService"
let mode5 = CellMode()
mode5.title = "漂流瓶"
mode5.image = "ff_IconBottle"
let arr2 = [mode4, mode5]
let mode6 = CellMode()
mode6.title = "購物"
mode6.image = "CreditCard_ShoppingBag"
let mode7 = CellMode()
mode7.title = "游戲"
mode7.image = "Userguide_Gamecenter_icon"
let arr3 = [mode6, mode7]
self.arr.append(arr)
self.arr.append(arr1)
self.arr.append(arr2)
self.arr.append(arr3)
}
func numberOfSections(in tableView: UITableView) -> Int {
return self.arr.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.arr[section].count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "tag", for: indexPath) as! DiscoverTableViewCell
//取出模型
let m = self.arr[indexPath.section][indexPath.row]
//cell.imageV?.image = UIImage(named: m.image!)
//cell.titleLabel?.text = m.title
cell.model = m
//取消選中按鈕
cell.selectionStyle = .none
//詳情按鈕
cell.accessoryType = .disclosureIndicator
return cell
}
//調(diào)整上頁邊距
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 0.1
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
}
//每個分組之間的間距
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 10
}
- 在DiscoverTableViewCell中鍵入:
private var imageV : UIImageView? = nil
private var titleLabel : UILabel? = nil
var model : CellMode {
set {
//newValue傳進(jìn)來默認(rèn)值
self.imageV?.image = UIImage(named: newValue.image!)
self.titleLabel?.text = newValue.title
}
get {
return CellMode()
}
}
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.imageV = UIImageView(frame: CGRect(x: 15, y: 5, width: 30, height: 30))
self.addSubview(self.imageV!)
self.titleLabel = UILabel(frame: CGRect(x: 55, y: 5, width: 200, height: 30))
self.addSubview(self.titleLabel!)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func awakeFromNib() {
super.awakeFromNib()
}
- 在IViewController中新建一個類:
class CellMode1 : NSObject {
var image1 : String? = nil
var title1 : String? = nil
var title2 : String? = nil
var image2 : String? = nil
}
IViewController要繼承UITableViewDelegate, UITableViewDataSource兩個協(xié)議;
在IViewController中鍵入:
//放分組對應(yīng)數(shù)據(jù)
var arr : [[CellMode1]] = [[CellMode1]]()
var tableView : UITableView? = nil
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
self.title = "我"
self.tableView = UITableView(frame: self.view.bounds, style: .grouped)
self.tableView?.delegate = self
self.tableView?.dataSource = self
self.view.addSubview(self.tableView!)
self.load()
//注冊
self.tableView?.register(I2TableViewCell.self, forCellReuseIdentifier: "tag")
self.tableView?.register(ITableViewCell.self, forCellReuseIdentifier: "tag2")
}
func load() {
let mode0 = CellMode1()
mode0.image1 = "nv.jpg"
mode0.title1 = "大叔的小蘿莉"
let arr0 = [mode0]
let mode1 = CellMode1()
mode1.title2 = "相冊"
mode1.image2 = "MoreMyAlbum"
let mode2 = CellMode1()
mode2.title2 = "收藏"
mode2.image2 = "MoreMyFavorites"
let mode3 = CellMode1()
mode3.title2 = "錢包"
mode3.image2 = "MoreMyBankCard"
let mode4 = CellMode1()
mode4.title2 = "卡包"
mode4.image2 = "MyCardPackageIcon"
let arr1 = [mode1, mode2, mode3, mode4]
let mode5 = CellMode1()
mode5.title2 = "表情"
mode5.image2 = "MoreExpressionShops"
let arr2 = [mode5]
let mode6 = CellMode1()
mode6.title2 = "設(shè)置"
mode6.image2 = "MoreSetting"
let arr3 = [mode6]
self.arr.append(arr0)
self.arr.append(arr1)
self.arr.append(arr2)
self.arr.append(arr3)
}
func numberOfSections(in tableView: UITableView) -> Int {
return self.arr.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.arr[section].count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "tag", for: indexPath) as! I2TableViewCell
//取出模型
let m = self.arr[indexPath.section][indexPath.row]
//cell.imageH?.image = UIImage(named: m.image1!)
//cell.nameLabel?.text = m.title1
cell.mode2 = m
//取消選中按鈕
cell.selectionStyle = .none
//詳情按鈕
cell.accessoryType = .disclosureIndicator
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: "tag2", for: indexPath) as! ITableViewCell
let m = self.arr[indexPath.section][indexPath.row]
//cell.imageV?.image = UIImage(named: m.image2!)
//cell.titleLabel?.text = m.title2
cell.mode1 = m
//取消選中按鈕
cell.selectionStyle = .none
//詳情按鈕
cell.accessoryType = .disclosureIndicator
return cell
}
//cell.model = m
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == 0 {
return 100
} else {
return 50
}
}
//調(diào)整上頁邊距
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 0.1
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
}
//每個分組之間的間距
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 10
}
- 在ITableViewCell中鍵入:
var imageV : UIImageView? = nil
var titleLabel : UILabel? = nil
var mode1 : CellMode1 {
set {
self.imageV?.image = UIImage(named: newValue.image2!)
self.titleLabel?.text = newValue.title2
}
get {
return CellMode1()
}
}
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.imageV = UIImageView(frame: CGRect(x: 15, y: 5, width: 30, height: 30))
self.addSubview(self.imageV!)
self.titleLabel = UILabel(frame: CGRect(x: 55, y: 5, width: 200, height: 30))
self.addSubview(self.titleLabel!)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
- 在I2TableViewCell中鍵入:
var imageH : UIImageView? = nil
var nameLabel : UILabel? = nil
var mode2 : CellMode1 {
set {
self.imageH?.image = UIImage(named: newValue.image1!)
self.nameLabel?.text = newValue.title1
}
get {
return CellMode1()
}
}
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.imageH = UIImageView(frame: CGRect(x: 15, y: 5, width: 80, height: 80))
self.imageH?.layer.cornerRadius = 8
self.imageH?.layer.masksToBounds = true
self.addSubview(self.imageH!)
self.nameLabel = UILabel(frame: CGRect(x: 105, y: 5, width: 200, height: 40))
self.nameLabel?.font = UIFont.systemFont(ofSize: 20)
self.addSubview(self.nameLabel!)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
- 在ViewController中對背景顏色進(jìn)行設(shè)置:
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
}
- 運行結(jié)果:
day16
新聞頁面
-
新建三個UIViewCell暂氯,分別為:TableViewCell潮模,STableViewCell,TTableViewCell痴施,并分別創(chuàng)建xib文件:
- 分別在這幾個xib中進(jìn)行控件的拖動及約束的設(shè)置擎厢,三個圖如下所示:
把相應(yīng)的控件按住control拖動到相應(yīng)的TableViewCell中設(shè)置為全局變量;
ViewController繼承UITableViewDelegate, UITableViewDataSource協(xié)議辣吃;
向ViewController中鍵入:
var tabelview : UITableView! = nil
override func viewDidLoad() {
super.viewDidLoad()
self.tabelview = UITableView(frame: self.view.frame, style: .grouped)
self.tabelview.delegate = self
self.tabelview.dataSource = self
self.view.addSubview(self.tabelview)
//注冊
self.tabelview.register(UINib(nibName: "TableViewCell", bundle: Bundle.main), forCellReuseIdentifier: "tag")
self.tabelview.register(UINib(nibName: "STableViewCell", bundle: Bundle.main), forCellReuseIdentifier: "tag1")
self.tabelview.register(UINib(nibName: "TTableViewCell", bundle: Bundle.main), forCellReuseIdentifier: "tag2")
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 3
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.row == 0{
let cell = tableView.dequeueReusableCell(withIdentifier: "tag", for: indexPath) as! TableViewCell
cell.titlelabel.text = "摩爾金融"
cell.detaillabel.text = "2016年投資展望:大勢分析+10大機會+10大金股"
cell.imageview.image = UIImage(named: "1")
cell.selectionStyle = .none
return cell
} else if indexPath.row == 1 {
let cell = tableView.dequeueReusableCell(withIdentifier: "tag1", for: indexPath) as! STableViewCell
cell.nameLabel.text = "做封面人物 秀出我的態(tài)度"
cell.firstimage.image = UIImage(named: "2")
cell.secondimage.image = UIImage(named: "3")
cell.thirdimage.image = UIImage(named: "4")
cell.selectionStyle = .none
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: "tag2", for: indexPath) as! TTableViewCell
cell.titleL.text = "新聞資訊"
cell.image1.image = UIImage(named: "5")
cell.selectionStyle = .none
return cell
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.row == 0 {
return 100
} else if indexPath.row == 1 {
return 150
} else {
return 200
}
}
- 運行結(jié)果:
day17
運用Main.storyboard
- 打開Main.storyboard动遭,將第一個ViewController設(shè)置為Navigation Controller,再拖動兩個View Controller神得,第一個View Controller上拖一個button控件厘惦,按住control鍵將button連到第二個View Controller上,選擇show哩簿,結(jié)果如圖:
- 新建一個RedViewController繼承自UIViewController:
var name : String! = nil
override func viewDidLoad() {
super.viewDidLoad()
print(name)
}
- 在ViewController中鍵入:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
//獲取目標(biāo)控制器
let vc = segue.destination;
//判斷目標(biāo)控制器是不是你想跳轉(zhuǎn)的
if vc is RedViewController {
let descriptionVc = vc as! RedViewController
descriptionVc.name = "張三"
}
}
- 運行結(jié)果:
單元格
- 在Main.storyboard中進(jìn)行控件的拖動及約束的設(shè)置宵蕉,如圖:
新建RootTableViewCell繼承自UITableViewCell酝静,將剛才約束好的控件進(jìn)行拖動至RootTableViewCell中;
將tableView按住control拖動至ViewController羡玛;
在ViewController中鍵入:
override func viewDidLoad() {
super.viewDidLoad()
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "RootTableViewCell", for: indexPath) as! RootTableViewCell
cell.titleLabel.text = "張姍"
cell.headImage.image = UIImage(named: "nv.jpg")
return cell
}
- 運行結(jié)果:
電話本
- 在Main.storyboard中進(jìn)行如前面的設(shè)置别智,三個頁面,并進(jìn)行約束稼稿,結(jié)果如圖:
新建RootTableViewCell繼承自UITableViewCell薄榛,將之前設(shè)置好的控件headImage
,titleLabel渺杉,detailLabel按住control拖入NextViewController中蛇数;新建NextViewController繼承自UIViewController挪钓,將之前設(shè)置好的控件nameTextField
是越,phoneTextField按住control拖入NextViewController中并鍵入:
var name : String! = nil
var phone : String! = nil
var sendMsg:((String, String)-> Void)! = nil
override func viewDidLoad() {
super.viewDidLoad()
self.nameTextField.text = self.name
self.phoneTextField.text = self.phone
}
@IBAction func btnAction(_ sender: UIButton) {
self.sendMsg(self.nameTextField.text!, self.phoneTextField.text!)
let _ = self.navigationController?.popViewController(animated: true)
}
- 在ViewController中拖入tableView并鍵入:
override func viewDidLoad() {
super.viewDidLoad()
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "RootTableViewCell", for: indexPath) as! RootTableViewCell
cell.headImage.image = UIImage(named: "nv.jpg")
cell.titleLabel.text = "姓名"
cell.detailLabel.text = "電話"
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 100
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let _ = self.RootTableView .indexPath(for: sender as! RootTableViewCell)
//先控制第二個控制器
let second = segue.destination
if second is NextViewController {
let sec = second as! NextViewController
sec.name = "張三"
sec.phone = "3333333333"
sec.sendMsg = {
print("name = \($0), phone = \($1)")
}
}
}
// func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
// return 0.1
// }
- 運行結(jié)果:
練習(xí)
- 在Main.storyboard中進(jìn)行控件的拖動及約束的設(shè)置,如圖:
將設(shè)置好的控件按住control拖入ViewController碌上;
在viewcontroller中添加兩個方法:
//點擊屏幕時走
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
self.textfield.resignFirstResponder()
}
//結(jié)束編輯
func textFieldDidEndEditing(_ textField: UITextField) {
self.label1.text = self.textfield.text
}
- 運行結(jié)果:
day18
好友列表
- 在ViewController中新建一個枚舉:
//控制分組的開關(guān)枚舉
enum Switch {
case open
case close
}
- 在ViewController中新建一個手勢類:
//繼承單擊手勢
class Tap : UITapGestureRecognizer {
var section : Int? = nil
}
ViewController繼承自UITableViewDelegate, UITableViewDataSource協(xié)議:
在ViewController中鍵入:
var tableView : UITableView! = nil
//前面是分組的頭部,后面是分組中的人員
var dic : [String:[String]] = [String:[String]]()
//keys的數(shù)組
var arr : [String] = [String]()
var SwitchArr : [Switch] = [.close,.close,.close]
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
dic["我的好友???"] = ["張三","李四","王五","趙六","小白"]
dic["朋友???"] = ["老李","小六","帥帥","張姍"]
dic["同學(xué)???"] = ["瓊哥","一姐","小哥","師俊南","靖媛","貓咪"]
//初始化一個數(shù)組
for item in dic.keys {
arr.append(item)
}
self.tableView = UITableView(frame: self.view.frame, style: .grouped)
self.tableView.delegate = self
self.tableView.dataSource = self
self.view.addSubview(self.tableView)
}
//頭部視圖
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 50
}
//自定義頭部視圖
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: 50))
//單擊手勢
let tap = Tap()
tap.section = section
view.addGestureRecognizer(tap)
tap.addTarget(self, action: #selector(tapAction(sender:)))
let label = UILabel(frame: CGRect(x: 300, y: 20, width: 120, height: 40))
if self.SwitchArr[section] == .close {
label.text = "▼"
} else {
label.text = "▲"
}
view.addSubview(label)
let label1 = UILabel(frame: CGRect(x: 20, y: 20, width: 120, height: 40))
label1.text = self.arr[section]
view.addSubview(label1)
return view
}
//打開手勢方法
func tapAction(sender: Tap) {
//先取出來section
let temp = sender.section //當(dāng)前點擊第幾個
//取反
if self.SwitchArr[temp!] == .close {
self.SwitchArr[temp!] = .open
} else {
self.SwitchArr[temp!] = .close
}
//刷新表格
self.tableView.reloadData()
}
//尾部視圖
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.1
}
//多少分組
func numberOfSections(in tableView: UITableView) -> Int {
return self.arr.count
}
//每組多少個
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
let Sswitch = self.SwitchArr[section]
if Sswitch == .close {
return 0
}
//先從數(shù)組中取出keys,再根據(jù)keys值取出對應(yīng)的數(shù)組
let array = dic[self.arr[section]]
return (array?.count)!
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell(style: .default, reuseIdentifier: "tag")
let array = dic[self.arr[indexPath.section]]
let str = array?[indexPath.row]
cell.textLabel?.text = str
return cell
}
- 運行結(jié)果:
(注:由于這周學(xué)的都是向xib中拖動控件而不是打代碼倚评,所以詳細(xì)的拖動步驟以及約束的設(shè)置都沒有向大家詳細(xì)的介紹,約束不會的地方以后會為大家再進(jìn)行總結(jié)馏予。)