Iphone UILabel故障
我在情节提要中创建了一个Iphone UILabel故障,iphone,objective-c,ios,ios5,storyboard,Iphone,Objective C,Ios,Ios5,Storyboard,我在情节提要中创建了一个ui标签 我的.h文件 @interface EditAndControll : UIViewController @property (strong, nonatomic) id detailItem; @property (strong, nonatomic) IBOutlet UILabel *deviceDetailLabel; - (void)configureView; @end 我的.m文件 @implementation EditAndControl
ui标签
我的.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);
}
}
请告诉我:
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];
}
}
我做错了什么?请帮忙 检查您称之为-(void)configureView
方法的表单
您需要将该方法称为
- (void)viewDidLoad {
// configureView method From here.
}
谢谢detailDevice的NSLog是什么意思?您从哪里调用[self-configureView]。此外,UILabel IBOutlet的属性应该是(非原子的,弱的)。哦,删除合成调用,如果您只使用标准调用,则不再需要它们。DetailDevice正常,从EditAndControll方法配置View调用为什么要编写DeviceCoreInfo*DetailDevice=[DeviceCoreInfo alloc]代码>?你在泄露记忆。七个小时的编码让我的大脑失明!你会好的!!每个人都好,欢迎来电!!!谢谢!