2014-11-04 21 views
0

下午好,實施的TableView導航的Xcode 6

我試圖按照從本網站教程:http://www.techotopia.com/index.php/Implementing_TableView_Navigation_using_Xcode_Storyboards實施的TableView導航,但在最後一步,我從我的Xcode得到一個錯誤。

我打算髮布代碼,我有錯誤代碼,因爲我對這個錯誤有點絕望。我希望你能幫助我。

CarDetailViewController.m - TableViewStory

#import "CarTableViewController.h" 
    #import "CarTableViewCell.h" 
    #import "CarDetailViewController.h" 

    @implementation CarDetailViewController 
    @synthesize makeLabel = _makeLabel; 
    @synthesize modelLabel = _modelLabel; 
    @synthesize imageView = _imageView; 
    @synthesize carDetailModel = _carDetailModel; 

    - (void)viewDidLoad 
    { 
     [super viewDidLoad]; 

     self.makeLabel.text = [self.carDetailModel objectAtIndex:0]; 
     self.modelLabel.text = [self.carDetailModel objectAtIndex:1]; 
     self.imageView.image = [UIImage imageNamed: 
           [self.carDetailModel objectAtIndex:2]]; 
    } 

    -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 
    { 
     if ([[segue identifier] isEqualToString:@"ShowCarDetails"]) 
     { 
      CarDetailViewController *detailViewController = 
      [segue destinationViewController]; 

      NSIndexPath *myIndexPath = [self.tableView 
             indexPathForSelectedRow]; 
------------PROPERTY TABLEVIEW NOT FOUND ON OBJECT OF TYPE 'CARDETAILVIEWCONTROLLER' 
      detailViewController.carDetailModel = [[NSArray alloc] 
                initWithObjects: [self.carMakes 
                    objectAtIndex:[myIndexPath row]], 
------------PROPERTY CARMAKES NOT FOUND ON OBJECT OF TYPE 'CARDETAILVIEWCONTROLLER' 
                [self.carModels objectAtIndex:[myIndexPath row]], 
                [self.carImages objectAtIndex:[myIndexPath row]], 
                nil]; 
     } 
    } 

    @end 

CarDetailViewController.h

#import <UIKit/UIKit.h> 


@interface CarDetailViewController : UIViewController 

@property (strong, nonatomic) NSArray *carDetailModel; 
@property (strong, nonatomic) IBOutlet UILabel *makeLabel; 
@property (strong, nonatomic) IBOutlet UILabel *modelLabel; 
@property (strong, nonatomic) IBOutlet UIImageView *imageView; 

@end 

在此先感謝。

+0

您爲'tableView'和'carMakes'得到「property not found」錯誤的原因是沒有名爲'tableView'或'carMakes'的屬性。 – 2014-11-04 20:29:59

回答

0

prepareForSegue你粘貼到CarDetailViewController來從教程中的CarTableViewController。據推測,該等級擴展爲UITableViewController(憑藉該屬性擁有tableView屬性)並具有自定義carMakes屬性。

但這只是涉及到這一個具體情況。我認爲了解您得到的錯誤意味着更重要,以便您可以識別未來如何解決它。您的代碼引用了無法找到的屬性,因爲它們不存在。這就是爲什麼你看到一個錯誤,告訴你無法找到屬性。這實際上是一個非常簡單的錯誤信息。

+0

我的重複答案 – 2014-11-04 20:33:25

+0

是的,我們基本上在同一時間回答。當我打字時,你的回答處於已刪除狀態。 – 2014-11-04 20:34:02

+1

感謝您的答案,它的工作。 – JulienKP 2014-11-04 20:41:14