我有以下代码viewDidLoad
(在导航栏中设置标题)因“发送到已释放实例的消息”错误而崩溃:
UILabel * label = [[[UILabel alloc] initWithFrame:CGRectMake(0,0,45,45)] autorelease];
label.textColor = [UIColor whiteColor];
label.backgroundColor=[UIColor clearColor];
label.font = [UIFont boldSystemFontOfSize:20];
label.font = [UIFont fontWithName:@"Mayfield Regular" size:15];
self.navigationItem.titleView = label;
label.text=@"SEARCH"; //CUSTOM TITLE
[label sizeToFit];
[label release];
我该如何解决这个问题?
谢谢你的帮助