我UILabel
在故事板中创建了一个。
我的.h 文件
@interface EditAndControll : UIViewController
@property (strong, nonatomic) id detailItem;
@property (strong, nonatomic) IBOutlet UILabel *deviceDetailLabel;
- (void)configureView;
@end
我的.m 文件
@implementation EditAndControll
@synthesize detailItem = _detailItem;
@synthesize deviceDetailLabel = _deviceDetailLabel;
- (void)setDetailItem:(id)newDetailItem
{
if (_detailItem != newDetailItem) {
_detailItem = newDetailItem;
// Update the view.
[self configureView];
}
}
- (void)configureView
{
if (self.detailItem)
{
DeviceCoreInfo *detailDevice = [DeviceCoreInfo alloc];
detailDevice = self.detailItem;
_deviceDetailLabel.text = detailDevice.deviceIP;
self.deviceDetailLabel.text=detailDevice.deviceIP;
NSLog(@"Device Label %@",_deviceDetailLabel);
NSLog(@"self Device LaBel %@", self.deviceDetailLabel);
}
}
NSLog 告诉我:
Device Label (null)
self Device LaBel (null)
我从主视图调用的所有内容:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"showDetail"]) {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
NSManagedObject *selectedObject = [[self fetchedResultsController] objectAtIndexPath:indexPath];
[[segue destinationViewController] setDetailItem:selectedObject];
}
}
我做错了什么?请帮忙!