Ios 在模拟器中尝试表视图详细信息视图时崩溃
我正在xcode 5中开发一个ios原型应用程序。基于选项卡的导航。我有一个视图控制器,它使用按钮推送到表视图。填充该表后,我们将尝试生成一个表内容的详细视图,当然还包含其他详细信息 单击表中的任意一行时,我会得到一个包含以下信息的崩溃:Ios 在模拟器中尝试表视图详细信息视图时崩溃,ios,crash,tableview,xcode5,Ios,Crash,Tableview,Xcode5,我正在xcode 5中开发一个ios原型应用程序。基于选项卡的导航。我有一个视图控制器,它使用按钮推送到表视图。填充该表后,我们将尝试生成一个表内容的详细视图,当然还包含其他详细信息 单击表中的任意一行时,我会得到一个包含以下信息的崩溃: argc int 1 1 argv char ** 0xbfffee34 0xbfffee34 及 我可以根据需要发布.h和.m文件 更新了其他文件: TableViewController2.h #import <UIKit/UIK
argc int 1 1
argv char ** 0xbfffee34 0xbfffee34
及
我可以根据需要发布.h和.m文件
更新了其他文件:
TableViewController2.h
#import <UIKit/UIKit.h>
@interface TableViewController2 : UITableViewController
@property (nonatomic, strong) NSArray *Images;
@property (nonatomic, strong) NSArray *Title;
@property (nonatomic, strong) NSArray *Description;
@end
如有必要,我还有DetailViewController和TableCell文件。您能展示一些代码吗?如果在查找项目崩溃的行时遇到问题,可以在xcode中打开异常断点。是否已将情节提要中的destinationViewController设置为DetailViewController2类型?如果没有,故事板将根据您从组件列表中拖出的内容实例化UIViewController或UITableViewController,这两个都没有名为setDetailModal的方法:就是这样!我没有更改自定义类。非常非常感谢。
#import <UIKit/UIKit.h>
@interface TableViewController2 : UITableViewController
@property (nonatomic, strong) NSArray *Images;
@property (nonatomic, strong) NSArray *Title;
@property (nonatomic, strong) NSArray *Description;
@end
#import "TableViewController2.h"
#import "TableCell2.h"
#import "DetailViewController2.h"
@interface TableViewController2 ()
@end
@implementation TableViewController2
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
_Title = @[@"Fire Station 1",
@"Fire Station 2",
@"Fire Station 3",
@"Fire Station 4",
@"Fire Station 5",
@"Fire Station 8",
@"Fire Station 9",
@"Fire Station 10",
@"Fire Station 11",];
_Description = @[@"London, England",
@"Rome, Italy",
@"China",
@"Moscow, Russia",
@"Liberty Island, New York",
@"Wiltshire, England",
@"Agra, India",
@"Paris, France",
@"Pisa, Italy",];
_Images = @[@"atl_station_01.jpg",
@"atl_station_02.jpg",
@"atl_station_03.jpg",
@"atl_station_04.jpg",
@"atl_station_05.jpg",
@"atl_station_08.jpg",
@"atl_station_09.jpg",
@"atl_station_10.jpg",
@"atl_station_11.jpg",];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return _Title.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"TableCell2";
TableCell2 *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
// Configure the cell...
int row = [indexPath row];
cell.TitleLabel.text = _Title[row];
cell.DescriptionLabel.text = _Description[row];
cell.ThumbImage.image = [UIImage imageNamed:_Images[row]];;
return cell;
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:@"ShowDetails"]) {
DetailViewController2 *detailviewcontroller = [segue destinationViewController];
NSIndexPath *myIndexPath = [self.tableView indexPathForSelectedRow];
int row = [myIndexPath row];
detailviewcontroller.DetailModal = @[_Title[row],_Description[row],_Images[row]];
}
}
@end