2012年11月12日月曜日

unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard

xcode4.5以降でUITableViewのdelegateメソッドが自動生成されると、このエラーが出る場合があります。
原因は

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{]
内に自動生成されたコードに
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

が記述されているからです。
このメソッドはiOS6.0以降でないと使用できません。
なのでiOS6.0未満も対応しているアプリではエラーとなってしまいます。

◎解決方法
従来の
- (id)dequeueReusableCellWithIdentifier:(NSString *)identifier; 
を使用するだけで解決します。

このエントリーをはてなブックマークに追加

0 件のコメント :

コメントを投稿