gpt4 book ai didi

ios - 实现 TableView 导航 xcode 6

转载 作者:行者123 更新时间:2023-11-29 02:32:10 27 4
gpt4 key购买 nike

下午好

我正在尝试按照此网站上的教程进行操作: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

提前致谢。

最佳答案

prepareForSegue 需要进入 CarTableViewController 而不是 CarDetailViewController

看起来有教程的第 1 部分,请确保您也遵循了它: http://www.techotopia.com/index.php/Using_Xcode_Storyboards_to_Build_Dynamic_TableViews_with_Prototype_Table_View_Cells

关于ios - 实现 TableView 导航 xcode 6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26744308/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com