0
내 view did load 메서드에서 막대 단추 항목에 문제가 있습니다. 나는 서브 뷰 그게 전부가 수퍼에 추가하고 난이 barbuttonitem을 클릭하면이 응용 프로그램을 충돌하고이 오류BarButtonItem이 응용 프로그램 충돌
*** -[DetailViewController performSelector:withObject:withObject:]: message sent to deallocated instance 0x27677fa0
- (void)viewDidLoad
{
[super viewDidLoad];
navBar.tintColor = [UIColor blackColor];
UIColor *topGreen = [UIColor colorWithRed:246/255.f green:241/255.f blue:206/255.f alpha:1];
UIColor *bottomGreen = [UIColor colorWithRed:242/255.f green:237/255.f blue:204/255.f alpha:1];
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = self.view.bounds;
gradient.colors = [NSArray arrayWithObjects:(id)topGreen.CGColor, (id)bottomGreen.CGColor, nil];
[self.view.layer insertSublayer:gradient atIndex:0];
backButton = [[UIBarButtonItem alloc] initWithTitle:@"Map" style:UIBarButtonSystemItemAction target:self action:@selector(returnToMap:)];
UINavigationItem *navButton = [[UINavigationItem alloc]init];
navButton.leftBarButtonItem = backButton;
[navBar pushNavigationItem:navButton animated:YES];
navBar.topItem.title = title;
NSLog(@"Reached");
//[self returnToMap];
//Do any additional setup after loading the view from its nib.
}
나는이 문제를 해결하는 방법을 잘 모르겠어요를 얻을. 속성으로 바 버튼을 추가하고 구문을 시도했지만 아무것도 작동하지 않는 것 같습니다. 어떤 도움이 좋을까
ARC가이를 처리해야합니까? – user1179321
실제로 ARC가 문제의 원인 일 수 있습니다. 그것은 당신의 코드에서 길을 잃었을 것이며'DetailViewController'가 더 이상 필요 없다고 가정합니다. 'returnToMap :'구현을 추가 할 수 있습니까? (앱이 버튼 탭 이후에 충돌합니다.) 메소드를 질문에 추가 할 수 있습니까? –