小编esa*_*its的帖子

当我打电话给[Timer isValid]或[Timer invalidate]时,NSTimer崩溃了

我的iPhone应用程序中有两个NSTimers.DecreaseTimer工作正常,但是当我调用[timerCountSeconds isValid]或[timerCountSeconds invalidate]时,TimerCountSeconds崩溃.他们像这样使用:

-(id)initialize { //Gets called, when the app launches and when a UIButton is pressed
 if ([timerCountSeconds isValid]) {
  [timerCountSeconds invalidate];
 } 
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { //Gets called, when you begin touching the screen
 //....
 if ([decreaseTimer isValid]) {
   [decreaseTimer invalidate];
  }
 timerCountSeconds = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(runTimer) userInfo:nil repeats:YES];
 //....
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {//Gets called, when you stop touching the screen(not if you press the UIButton for -(id)initialize)
 //...
 decreaseTimer = …
Run Code Online (Sandbox Code Playgroud)

iphone crash xcode objective-c nstimer

10
推荐指数
1
解决办法
7993
查看次数

禁用全窗口拖动

当我使用AWTUtilities.setWindowOpaque(this, false);JFrames的背景透明时,您可以通过将其拖动到窗口中的任何位置来更改我的JFrame的位置.我的问题是,我有想要用于拖放这个Frame的对象,但是当我试图拖动一个对象时JFrame移动它不可能在其他任何地方丢弃它.有什么方法可以解决这个问题吗?

顺便说一句,我使用Mac OS 10.6.6在Mac上

谢谢你的帮助!

java macos transparency drag

0
推荐指数
1
解决办法
1762
查看次数

标签 统计

crash ×1

drag ×1

iphone ×1

java ×1

macos ×1

nstimer ×1

objective-c ×1

transparency ×1

xcode ×1