开发者

IBAction UIButton and EXC_BAD_ACCESS

开发者 https://www.devze.com 2022-12-29 14:09 出处:网络
in .h file I write -(IBAction)openShuffleForm; and .m -(IBAction)openShuffleForm{ NSLog(@\"XXXXXXX\"); } and connect with even touch up inside

in .h file I write

-(IBAction)openShuffleForm;

and .m

-(IBAction)openShuffleForm{
   NSLog(@"XXXXXXX");
}

and connect with even touch up inside but when I run my program it error show this message

-[UITouchData openShuffleF开发者_Go百科orm]: unrecognized selector sent to instance 0x391cc20

** What happen I don't know why?


Did you create the link between the button and the implementation? The implementing class should have an IBOutlet of type UIButton. Bind the IBOutlet to the button in Interface builder. This will cause the button to automatically be instantiated when the view is rendered and the BAD ACCESS should be alleviated.


In my case it was a modal window which I released after opening. Thus any button which I clicked to try to call ANY IBAction would not work from that Modal View and kill the app with SIGBART or BAD_EXEC errors.

0

精彩评论

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