UIButtons
タップするとセグエする「メインページ」を持つアプリを作成しようとしていUITableView
ます。これは、別のビューなどにセグエします。コードにエラーや警告はなく、うまく設計したと思いましたが、アプリを実行しても、PrototypeCells は表示されません。
これが現在のストーリーボードのセットアップ方法です (申し訳ありませんが、私は新しいユーザーであるため、まだ画像を投稿できません)。小さなビール ジョッキは、UITableView ウィンドウへの Segue を正常に実行する UIButton です (これは、PrototypeCells をロードしないウィンドウです)。
Brew View Controller には、デフォルトのメソッド以外のコードはありません。
Brewery というクラスを作成し、次のプロパティを指定しました。
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *address;
@property (nonatomic, copy) NSString *info;
@property (nonatomic, copy) NSString *brews;
Brewery View Controller を作成し、デフォルト コードとともに次のメソッドを追加しました。
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [self.breweries count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BreweryCell"];
Brewery *brewObject = [self.breweries objectAtIndex:indexPath.row]; //might be an error in here
cell.textLabel.text = brewObject.name;
return cell;
}
しかし、これを実行すると、PrototypeCells も表示されません。ReuseIdentifier はストーリーボードとコードの両方で一致し、View は dataSource と Delegate にアタッチされます。誰かが私が間違っていることを理解するのを手伝ってくれますか? 私もこのサイトを初めて使用するので、何か間違っている点がある場合、または私を支援するためにさらに情報が必要な場合はお知らせください.