开发者

makeKeyAndOrderFront: again causes EXC_BAD_ACCESS

Im sure this is开发者_StackOverflow中文版 something really simple I'm missing. I use makeKeyAndOrderFront: to open a window and it works the first time. When I close the window and try and open it again it quits and gives me the error EXC_BAD_ACCESS. My code is this:

- (IBAction)viewScreen:(id)sender {

[screenView makeKeyAndOrderFront:sender];
}

I can't figure out why this is happening and the debugger console isn't saying much of anything.

Thanks in advance


Why are you calling your window variable screenView? That sounds like it should refer to a view, not a window.

Check whether your window has the “Release when closed” property turned on in IB. When that property is on, the window will release itself when anything or anybody closes it. This can be handy, but if you intend to show the same window again later on, it's probably not what you want.

More generally, you can use Instruments's Zombies template to debug crashes like this.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜