Xcode 无法识别@property
详细控制器。
ViewController2 的 .m 文件:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"showDetail"])
{
NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] objectAtIndex:0];
// load the image.
NSString *imageNameToLoad = [NSString stringWithFormat:@"%d", selectedIndexPath.row];
NSString *pathToImage = [[NSBundle mainBundle] pathForResource:imageNameToLoad ofType:@"JPG"];
UIImage *image2 = [[UIImage alloc] initWithContentsOfFile:pathToImage];
Detail_ViewController_Biffy *detailViewController = [segue destinationViewController];
Detail_ViewController_Biffy.**image = image;** <--- fails [property 'image'not found on object of type 'detail_ViewController_Biffy'
}
}
detail_view 的 .h 文件
#import "ViewController.h"
@interface ViewController_Biffy : ViewController
@property (strong, nonatomic) IBOutlet UIImageView *image;
@end
试图将导入更改ViewController.h
为ViewController_Biffy.h
但导致更多错误。
如果您需要更多信息,请告诉我。