Я относительно новичок в разработке для iPhone, я попытался добавить uitableview в представление с прокруткой, но оно показывает ошибку Sigabart, затем я добавил программно, добавил в него источник данных uitableviewdelegate и uitableview, предоставил делегату self и добавил метод noOfRowsInSection. Методы delgate не называются. Кто-нибудь может мне помочь.
@interface Class : UIViewController<UITableViewDelegate,UITableViewDataSource> {
UITableView *table;
UIScrollView *scrView;
NSArray *array;
}
@property (nonatomic, retain) IBOutlet UIScrollView *scrView;
@end
here is my implementation
- (void)viewDidload
{
array = [[NSArray alloc]initWithObjects:@"harsha",@"theja",@"pandu", nil];
[super viewDidUnload];
table = [[UITableView alloc]initWithFrame:CGRectMake(0, 260, 360, 220)];
[self.view addSubview:table];
table.delegate = self ;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [array count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.text = [array objectAtIndex:indexPath.row];
return cell;
}
@end
Я добавляю представление прокрутки, хотя построитель интерфейса, но я делаю представление таблицы программно, на экране отображается представление таблицы, но методы не называются