ストーリーボードでUILabel
作成しました。
my.hファイル
@interface EditAndControll : UIViewController
@property (strong, nonatomic) id detailItem;
@property (strong, nonatomic) IBOutlet UILabel *deviceDetailLabel;
- (void)configureView;
@end
my.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];
}
}
私は何が間違っていますか?助けてください!