2012-01-19 2 views
0

나는 이상한 곳에서 뛰어 다니고 있습니다. Xcode 4.2.1 또는 iOS 5로 업데이트하지 않았기 때문에 확실하지 않습니다.iITableView가 iOS 5를 실행하는 iPad를 표시하지 않습니다.

OS 4.0-5.0에서 실행되는 iPad 응용 프로그램이 있습니다.

저는 양식에 모달로 표시되는보기에 포함 된 UITableView가 있습니다.

테이블이 4.x에서 잘 실행되지만 5.0에서 실행하면 테이블이 사라집니다.

나는 모두가 이걸 100 만번 들었다는 것을 알고 있지만, 어제는 문자 그대로 잘 작동하고 있었고, 나는 아무것도 바뀌지 않았다. 이제는 작동하지 않는다. iOS 5를 실행하는 추가 iPad에 설치된 어제의 작업 사본이 있습니다. 오늘은 작동하지 않습니다.

다음은 설정 방법입니다. 문제가있을 수 있습니다.

  1. IB에서 UITableView가 생성되었습니다. 데이터 소스와 델리게이트가 설정되었습니다.

  2. 뷰는과 같이 호출되고
  3. :

GuidedSearchPriceViewController *guide = [[GuidedSearchPriceViewController alloc] initWithNibName:@"GuidedSearchPriceViewController_iPad" bundle:nil]; 
UINavigationController *temp = [[UINavigationController alloc] initWithRootViewController:guide]; 
temp.modalPresentationStyle = UIModalPresentationFormSheet; 
[guide setModalDelegate:self]; 
[guide setAppDelegate:self.appDelegate]; 
temp.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 
[self presentModalViewController:temp animated:YES]; 

의 iOS 4.x의에서 우리가 얻을이 : iOS 4.x

그러나 이다에서 iOS 5 우리는 이것을 얻었습니다 : ,210

가격보기의의 viewDidLoad 방법은 다음과 같습니다

- (void)viewDidLoad 
{ 

    [super viewDidLoad]; 

    //Tried for testing but still does nothing 
    self.table.delegate = self; 
    self.table.dataSource = self; 

    UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:@"Type" style:UIBarButtonItemStyleBordered target:self action:@selector(nextScreen)]; 
    addButton.enabled = NO; 
    self.navigationItem.rightBarButtonItem = addButton; 

    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { 
     UIBarButtonItem *cancel = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(dismiss)]; 

     self.navigationItem.leftBarButtonItem = cancel; 
     self.navigationController.navigationBar.tintColor = [UIColor redColor]; 
     self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.png", [[NSBundle mainBundle] bundlePath], RP_iPad_FormsheetBackground]]]; 

    } else 
     self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.png", [[NSBundle mainBundle] bundlePath], RP_BackgroundImage]]]; 

    // Make sure the background of the table is clear. I have also tried taking this out 
    // to resolve the disappearing issue but it has no effect. 
    if ([self.table respondsToSelector:@selector(backgroundView)]) { 
     [self.table setBackgroundView:nil]; 
     [self.table setBackgroundView:[[UIView alloc] init]]; 
     [self.table setBackgroundColor:UIColor.clearColor]; 
    } 

    priceList = [[NSArray alloc] initWithObjects:@"$750", @"$1000", @"$1250", @"$1500", @"$1750", @"$2000", @"$2000 +", nil]; 

} 

어떤 도움 주셔서 대단히 감사합니다, 언제나처럼 시간 내 주셔서 감사합니다.


답변

나는 문제가 무엇인지 알아 내기 위해 관리하지만 나는 그것이 발생하는 이유를 모르겠습니다. 어쩌면 누군가가 그것에 대해 밝힐 수 있습니다.

나는 내가 그것을에서 iOS 5에서가 아니라 아이폰 OS 4.x의에있을하는 이유를 모르겠어요 -(void)viewDidLoad

의 말에

[table reloadData];

를 삽입했다

+0

새로운 컴파일러 경고 또는 런타임 경고가 있습니까? – dtuckernet

+0

네거티브 선생님. 나는 '- (UITableViewCell *) tableView : (UITableView *) tableView cellForRowAtIndexPath : (NSIndexPath *) indexPath'에서 중단 점을 설정하여 호출되는 것을 확인했습니다. (그것은 불리고있다). – random

+0

문제를 직접 해결 한 경우 스택 오버플로에서 해결책을 제시하고 직접 수락하는 것이 일반적입니다. 그런 식으로 모든 사람이 질문을 해결할 수 있습니다 :) – deanWombourne

답변

1

테이블보기에 UITableViewController을 사용하는 경우 “When the table view is about to appear the first time it’s loaded, the table-view controller reloads the table view’s data.”

“If you choose not to use UITableViewController for table-view management, you must replicate what this class gives you ‘for free.’”

두 번째 링크의 샘플 코드는 델리게이트 및 데이터 소스를 설정 한 후 reloadData을 테이블에 보냅니다.아마도 iOS 4에서는 테이블 뷰가로드 될 때 자동으로로드되고 iOS 5에서는 문서와 일치하도록 테이블 뷰가 변경되었습니다.

관련 문제