我正在使用xcode 5中的原型ios应用程序。基于标签的导航。我有一个View Controller,它使用一个按钮推送到Table View。填充该表后,我们将尝试生成表格内容的详细视图(当然还有其他详细信息)。
单击表格的任何一行后,我会收到以下信息的崩溃:
argc int 1 1
argv char ** 0xbfffee34 0xbfffee34
和
2014-01-01 17:25:11.430 AtlantaFire1215[10475:70b] -[UIViewController setDetailModal:]: unrecognized selector sent to instance 0xb5a2d50
2014-01-01 17:25:11.433 AtlantaFire1215[10475:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController setDetailModal:]: unrecognized selector sent to instance 0xb5a2d50'
*** First throw call stack:
我可以根据需要发布.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
TableViewController2.m
#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
如有必要,我还有“DetailViewController”和“TableCell”文件。