2011-01-28 4 views
0

아이폰 앱에 3 개의 버튼이있는보기가 있는데 특정 버튼을 클릭하여 다른보기로 이동하려는 경우 대상 메서드를 추가하려고 시도했지만 제대로 작동했지만 탐색 후 다음보기로 이동할 때 뒤로 버튼을 클릭하면 충돌이 발생합니다. ??응용 프로그램 특정 지점에서 충돌 발생

여기 내 코드입니다. 난 당신의 코드를 볼 때

- (void)viewDidLoad { 

    [super viewDidLoad]; 
    helpButton=[UIButton buttonWithType:UIButtonTypeRoundedRect]; 
    helpButton.frame= CGRectMake(5, 370, 90, 30); 
    [helpButton setTitle:[NSString stringWithFormat:@"Help"] forState:UIControlStateNormal]; 
    [helpButton addTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside]; 
    helpButton.tag=1; 
    [self.view addSubview:helpButton]; 
} 

사전

+1

는 여기에 몇 가지 코드를 붙여

helpButton=[[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; 

그것은 당신의 문제를 해결하지만, 그것은 도움이되지 확인 ... 과거 콘솔 출력. –

+0

- (무효) viewDidLoad { \t \t [super viewDidLoad]; \t helpButton = [UIButton buttonWithType : UIButtonTypeRoundedRect]; \t helpButton.frame = CGRectMake (5, 370, 90, 30); \t [도움말 버튼 setTitle : [NSString stringWithFormat : @ "도움말"] forState : UIControlStateNormal]; [helpButton addTarget : 자기 동작 : @selector (btnClicked :) forControlEvents : UIControlEventTouchUpInside]; \t helpButton.tag = 1; \t [self.view addSubview : helpButton]; – User

+0

앱이'viewDidLoad :'메소드에서 충돌이 발생합니까? – EmptyStack

답변

0

나에게

감사를 도와주세요, 당신의 도움말 버튼은 클래스 변수가 사실이라면, 당신은이 유지 누락 ... 것 같다 :

+0

WTF ??? 이것은 UIButton의 일반적인 생성자이므로 유지하면 안됩니다. –

+1

클래스의 멤버 인 경우 잘 클래스 dealloc에서 해제 될 가능성이 있습니다 ... 그것은 내가 가리키고있는 것입니다. – Romain

+0

많은 도움을 주셔서 감사합니다. 사실 바보 같은 실수를 저질렀습니다. 네비게이션 컨트롤러 개체를 공개했는데, 어쨌든 다시 한번 감사드립니다. – User

관련 문제