【Swift4】ToDoリストアプリを作りながらUITableViewを学ぼう!〜Part1 【説明動画付き】

UITableView はiOSのUIフレームワークに含まれる代表的なクラスのひとつです。UITableViewを使ってないアプリは無いくらい重要なクラスです。今回のPart1はTable View Controllerの追加、Storybordとの紐付け、NavigationBarにBar Button Itemを追加、NavigationVarの追加をやっていこうと思います。

参考動画

Table View Controllerの追加

Table View Controllerをstorybordに追加します

→をTable View Controllerに持ってきます

元々あったView Controllerを消します

ViewControllerの名前を変更

左にあるファイル名を「ViewController」→「TodoViewController」に変更。
また、コードの中にあるViewControllerをTodoViewControllerに、スーパークラスのUIViewControllerの部分もUITableViewControllerに変更します。

Storybordとの紐付け

Storybordと先程名前を変更したTodoViewControllerを紐付けるために、ClassをTodoViewControllerにします。

Identifierの追加

TableViewのCellを紐づけるためにIdentifierにToDoと入力します

NavigationVarの追加

上の方にあるEditor→Embedin→Navigation ControllerからNavigationVarを選択し、追加します

NavigationBarにタイトルを追加

左の方にあるNavigationBar Item をクリックし、タイトルを追加します

NavigationBarの色の変更

NavigationBarにBar Button Itemを追加

「Navigation Bar」の右の部分に追加します。「System Item」から「Add」を選ぶと「+」に変わります。

この次はPart2で!




FLY-WESTプログラミングスクールでは格安で未経験からフリーランスエンジニアへ導きます!

© Copyrights Spot. All Rights Reserved

Created with by FLY-WEST