두 개의 UITableViews, 하나의 사용자 정의 셀 XIB 테이블 뷰 및 다른 기본 동적 테이블 뷰가있는 UIViewController가 있습니다. 사용자 정의 셀 tableview는 대리자를 실행하지만 다른 테이블 뷰는 실행되지 않습니다. 코드하나의 UIViewController에서 사용자 정의 셀 테이블 뷰 및 기본 UITableView
@interface Question : UIViewController<UITableViewDataSource,UITableViewDelegate>
그리고하는 .m
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if(tableView == _similarTable)
{
tableCell =(SimilarQuestion *)[_similarTable dequeueReusableCellWithIdentifier:@"similarTable"];
if(tableCell == nil)
{
tableCell = [[[NSBundle mainBundle]loadNibNamed:@"SimilarQuestion" owner:self options:Nil]objectAtIndex:0];
}
if(finalAskerArray!=nil && finalQuesArray.count >0)
{
tableCell.questionText.text= [finalQuesArray objectAtIndex:indexPath.row];
tableCell.lblAsker.text=[finalAskerArray objectAtIndex:indexPath.row];
}
return tableCell;
}
else
{
NSLog(@"==>Hit");
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"categoryTable"];
if (cell == nil)
{
cell = [[[NSBundle mainBundle]loadNibNamed:@"categoryTable" owner:self options:nil]objectAtIndex:0];
}
if(popCategoryArray != nil && popCategoryArray.count >0)
{
cell.textLabel.text = [popCategoryArray objectAtIndex:indexPath.row];
}
return cell;
}
}
내가 버튼을 클릭의 기본 테이블보기 아래로 버튼 클릭에 코드를 호출
-(IBAction)catBtnPressed:(id)sender{if(categoryArray.count !=0) {
popCategoryArray = categoryArray;
categoryView = [[UIView alloc]initWithFrame:CGRectMake(0.0, 0.0, 320 , 548)];
categoryTable.delegate = self;
categoryTable.dataSource =self ;
[UIView transitionWithView:categoryView duration:2.0
options:UIViewAnimationOptionTransitionFlipFromTop
animations:^{
[self.view addSubview:categoryView];
} completion:NULL];
categoryTable = [[UITableView alloc]initWithFrame:CGRectMake(0.0, 0.0, 320, 240)];
[categoryTable reloadData];
[categoryView addSubview:categoryTable];
[self.view addSubview:categoryView];
}
[categoryTable reloadData]는 절대 위임을 호출하지 않습니다. 내가 어디로 잘못 가고 있니? , self
는
categoryTable.delegate = self ;
categoryTable.dataSource = self ;
self
보기 categoryTable
를 포함하면 코드에서 UIViewController에 있습니다 :
categoryTables 위임을 설정하셨습니까? – vikingosegundo
예 - (IBAction)을 확인하십시오. catBtnPressed – KhanXc
은'catBtnPressed :'wired up입니까? – vikingosegundo