我正在尝试将值(UIImage、NSString)传递给另一个 ViewController,但它不起作用。
我的代码如下所示:
第一个 ViewController.m
#import 2nd ViewController.h
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
AppDetail *advc = [[AppDetail alloc] init];
if ([[segue identifier] isEqualToString:@"showDetail"]) {
advc.appTitel = name;
advc.appIcon = icon;
advc.detailAppName = detileName;
advc.appDescription = description;
}
}
第二个 ViewController.h
#import <UIKit/UIKit.h>
@interface AppDetail : UIViewController
@property (strong, nonatomic) NSString *appTitel;
@property (strong, nonatomic) UIImage *appIcon;
@property (strong, nonatomic) NSString *detailAppName;
@property (strong, nonatomic) NSString *appDescription;
@end
第二个 ViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = self.appTitel;
self.appIconImageView.image = self.appIcon;
self.detailAppNameTextView.text = self.detailAppName;
self.appDescriptionTextView.text = self.appDescription;
}
但我总是得到(null)
所有的价值!
我究竟做错了什么??