开发者

Application Crashing at a particular point

开发者 https://www.devze.com 2023-02-07 01:25 出处:网络
I have a view with three buttons in an iphone app, want to go to another view by clicking a particular button, tried add target method, its working fine but when we go to next view after navigation an

I have a view with three buttons in an iphone app, want to go to another view by clicking a particular button, tried add target method, its working fine but when we go to next view after navigation and click on the back button their it crashes??

Here is my code.

- (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];
}

Please help me

Thanks in advance


when I look at your code, it seems that your helpButton is a class variable... If it is true, you are missing a retain :

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

not sure it will fix your problem, but it can help...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号