I'm beginer in Objective-C and iOS word, I try to learn how to do nice apps for iOS.
I try to create a TableViewController, so I make a class, but I have some problem with this code, and I don't know why. I describe all in the code in the comments.
This is Code.
BooksTableViewController.m
import "BooksTableViewController.h"
@implementation BooksTableViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil //Semantic Issue - Designated initializer missing a 'super' call to a designated initializer of the super class
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];// Parse Issue - Expected expression
if(self){
self.title = @"Books";
self.tabBarItem.image = [UIImage imageNamed:@"books8.png"];
self.imiona = @[@"Pan Tadeusz", @"Potop", @"Lalka", @"Uczta dla wron", @"Symfonnia C++"];
}
return self;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.imiona.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Title"];
if(cell == nil){
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Title"];
}
cell.textLabel.text = self.imiona[indexPath.row];
return cell;
}
@end
Thank You for help !