2014-12-28 3 views
0

mapviewController에서 push segue를 사용하여 스토리 보드에 설정 한 테이블 뷰가있는 테이블 뷰 컨트롤러가 있습니다. 사용자가 통지의 방법으로 간접적으로 주석 선을 calloutAccessoryControllTapped가 호출되는 함수를 제공하는 iOS 및 그것을 만졌을 때이 제대로 작동UITableViewDelegate cellForRowAtIndexPath가 호출되지 않았습니다.

[self performSegueWithIdentifier:@"SequeToConversationList" sender:self]; 

했다.

그러나 제공된 콜 아웃을 XIB에 레이아웃 된 사용자 정의 콜 아웃으로 교체했습니다. 그것에는 실행중인 코드와 동일한 행이있는 액션이있는 버튼이 있습니다. 그러나 Segue가 tableView로 이동하지만 tableViewController의 cellForRowAtIndexPath는 결코 호출되지 않습니다. titleForHeaderInSection은 UITableViewDataSource 역할을한다는 것을 나타냅니다.

누구든지 아이디어가 있습니까? 코드 요청 당

:

.H :

#import <UIKit/UIKit.h> 

@interface PhListTableViewController : UITableViewController <UITableViewDataSource,UITableViewDelegate> 

@end 

하는 .m :

#import "PhListTableViewController.h" 
#import "PhSettings.h" 

@interface PhListTableViewController() 

@end 

@implementation PhListTableViewController 

- (id)initWithStyle:(UITableViewStyle)style 
{ 
    self = [super initWithStyle:style]; 
    if (self) { 
     // Custom initialization 
    } 
    return self; 
} 

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    PhSettings *settings=[PhSettings getInstance]; 
    settings.currentViewController = CONV_LIST; 

    //... 

} 


#pragma mark - Table view data source 

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
{ 
#warning Potentially incomplete method implementation. 
    // Return the number of sections. 
    return 1; 
} 

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{ 
#warning Incomplete method implementation. 
    // Return the number of rows in the section. 
    PhSettings *settings=[PhSettings getInstance]; 
    return [settings.myUUIDsList count]; 
} 
- (NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{ 

    return @"Active:"; 
} 

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath]; 

    // Configure the cell... 
    PhSettings *settings=[PhSettings getInstance]; 
    NSMutableString *s = [NSMutableString string]; 
    [s appendString:@"Alias:"]; 
    [s appendString:[[settings.myUUIDsList objectAtIndex:indexPath.row] userAlias]]; 
    [s appendString:@"Category: "]; 
    [s appendString:[[settings.myUUIDsList objectAtIndex:indexPath.row] category]]; 

    cell.textLabel.text=s; 

    return cell; 
} 

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    //indexPath.row 
    // ... 
} 

@end

cellForRowAtIndexPath 때문에 하나 (또는 ​​그 이상)라고 할 수 없습니다
+0

XIB에서 델리게이트와 데이터 소스를 링크 시켰습니까? –

+0

XIB는 주석 사용자 지정 설명 선에만 사용됩니다. 그것은 segue 시작과 직접 관련이 없습니다. 알림을 통해 이루어집니다. 나는. 사용자가 사용자 정의 콜 아웃의 버튼을 선택하면 일부 라운드 트립 서버 작업이 발생하고 해당 콜백이 완료되면 mapViewController에 알림이 전송되어 segue가 시작됩니다. – bhartsb

+0

코드를 게시하여 사용자 정의 tableView를 게시 할 수 있습니까? 그래서 우리는 파고 들어갈 수 있습니다. –

답변

3

다음과 같은 이유가 있습니다.

  1. numberOfRowsInSection 반환 0
  2. numberOfSectionsInTableView 반환 0
  3. 데이터 소스는 제대로
  4. heightForRowAtIndexPath 0
  5. 표는 경우 높이 및/또는 폭

0의 프레임 크기가 반환 설정하지 나의 가장 좋은 기회는 숫자 1이다 (테이블에 행 개수를 요청할 때 얼마나 많은 행을 반환하는지 보려면 메서드에 중단 점을 배치한다). 제 최악의 경험은 5 번 디버깅이었습니다 :)

+0

# 4 잘못되었습니다 - 여전히 호출됩니다. –

관련 문제