でセルをデキューすることができないのObjective-C「識別子のニュースでセルをデキューすることができない - 識別子のためのペン先やクラスを登録したり、ストーリーボードでプロトタイプセルを接続する必要があります」iOSの - 識別子
#import "SidebarViewController.h"
#import "SWRevealViewController.h"
@interface SidebarViewController()
@property (nonatomic, strong) NSArray *menuItems;
@end
@implementation SidebarViewController
NSArray *menuItems;
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
//custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
menuItems = @[@"title", @"news ", @"comments", @"map", @"calendar", @"wishlist", @"bookmark", @"tag"];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (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 menuItems.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *CellIdentifier = [menuItems objectAtIndex:indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
return cell;
}
@end
識別子は、次のようになります。
私はこれで何ができるのでしょうか?
左側のスライドメニューを追加しようとしていますが、メニューボタンを押すとクラッシュします。
スタティックセルですか?もしそうでなければ、どうしてそんなにたくさんあるのですか?テキストと画像を除いて、それらのセルは同じように見えます。これは 'cellForRowAtIndexPath'で設定する必要があります。静的なセルであれば、それらをデキューしないでください。 – Paulw11
@ Paulw11プロトタイプセル –
あなたが提示している 'SideBarViewController'のインスタンスを作成したコードを表示できますか? – Paulw11