質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.46%
Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

Swift

Swiftは、アップルのiOSおよびOS Xのためのプログラミング言語で、Objective-CやObjective-C++と共存することが意図されています

Q&A

解決済

1回答

2997閲覧

Cannot find 'M' in scopeというエラーがでてしまう

misokota

総合スコア36

Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

Swift

Swiftは、アップルのiOSおよびOS Xのためのプログラミング言語で、Objective-CやObjective-C++と共存することが意図されています

0グッド

0クリップ

投稿2021/07/29 02:52

編集2021/07/31 09:45
import UIKit class MainTableViewController: UITableViewController { private let cellId = "cellId" private let players = [ ["山田","小林","田中","佐藤","卯類","竹富"], ["山田","小林","田中","佐藤","卯類","竹富"], ["山田","小林","田中","佐藤","卯類","竹富"] ] override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .white tableView.register(MainTableViewCell.self, forCellReuseIdentifier: cellId) setupNavigationBar() } private func setupNavigationBar() { navigationItem.title = "NBA Player" navigationItem.largeTitleDisplayMode = .always navigationController?.navigationBar.prefersLargeTitles = true //navigationの背景色を変更 let appearance = UINavigationBarAppearance() appearance.configureWithDefaultBackground() appearance.backgroundColor = UIColor(white: 0.9, alpha: 1) navigationController?.navigationBar.scrollEdgeAppearance = appearance navigationController?.navigationBar.standardAppearance = appearance } } //MARK - tableViewの設定 extension MainTableViewController { override func numberOfSections(in tableView: UITableView) -> Int { return players.count } override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { return 50 } override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let label = UILabel() label.text = "Aチーム" label.textAlignment = .center label.backgroundColor = .darkGray label.textColor = .white switch section { case 0: label.text = "Aチーム" case 1: label.text = "Bチーム" case 2: label.text = "Cチーム" default: break } return label } override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return 60 } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return players[section].count } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: cellId, for: indexPath) as! MainTableViewCell //cell.textLabel?.text = players[indexPath.section][indexPath.row] return cell } }

最初の方にある tableView.register(MainTableViewCell.self, forCellReuseIdentifier: cellId)がCannot find 'M' in scopeというエラーがでて消えません。
解決方法を教えて欲しいです。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

ProductのClean Build Folderで解決した。

投稿2021/08/02 13:06

misokota

総合スコア36

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.46%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問