Ich erhalte die Fehlermeldung:Nicht erkannte Selector Sent Instanz UIViewController
NSInvalidArgumentException', reason: '-[UIViewController setPhotoCellName:]: unrecognized selector sent to instance
, wenn ich meine Eingabe vorbereiten für segue Anruf. Zur Zeit habe ich
TabBarController->NavigationController->TableViewController->TableViewController->ViewController
mit einem UI-Bild darauf.
Das Problem tritt auf, wenn ich versuche, vom zweiten TableView-Controller zum ViewController zu wechseln. Ich habe das Segment-Setup von der Prototyp-Zelle zum eigentlichen ViewController. Es betritt das Segment und stürzt ab. Ich versuche, eine NSArray
Eigenschaft an die viewController
zu übergeben, um in der Lage zu sein, eine URL darin zu verwenden und die UIImage
anzuzeigen. PhotoInPlace enthält das Array, das Im übergeben wird. Hier ist der Code.
myTableViewControllerPhotoLocation.m-Code
#import "myTableViewControllerPhotoLocation.h"
#import "FlickrImageViewController.h"
@interface myTableViewControllerPhotoLocation()
@end
@implementation myTableViewControllerPhotoLocation
@synthesize photoInPlace = _photoInPlace; //Contains NSArray to pass
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if([segue.identifier isEqualToString:@"Photo Display"]){
NSIndexPath* indexPath = [self.tableView indexPathForCell:sender];
NSLog(@" Dicitonary = %@", [self.photoInPlace objectAtIndex:indexPath.row]); //Returns the picked cell
NSLog(@"%@", [self.photoInPlace class]); //returns NSArray
NSLog(@"%@", [self photoInPlace]); //Returns the array
[segue.destinationViewController setPhotoCellName:[self.photoInPlace objectAtIndex:indexPath.row]];
//Crashes HERE!
}
}
FlickrImageViewController.h-Code
@property (nonatomic, strong) NSArray* photoCellName;
FlickrImageViewController.m-Code
#import "FlickrImageViewController.h"
@interface FlickrImageViewController()
@end
@implementation FlickrImageViewController
@synthesize photoCellName = _photoCellName; //property declared in header
-(void) setPhotoCellName:(NSArray *)photoCellName{
if(!_photoCellName)
_photoCellName = [[NSArray alloc] initWithArray:photoCellName];
else {
_photoCellName = photoCellName;
}
}
Ich benutzte diese Art von Code, um ein Array in der vorherigen TVC übergeben Ich weiß nicht, warum es auf diesem –