书上例程,提示Tread 1:Program received signal:"SIGABRT"难道是链接没有链接好?
部分代码/*eventreporterViewController.m*/
/*eventreporterViewController.m*/
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
[self.nextResponder manageTouches:touches];
}
-(void) touchesENDed:(NSSet *)touches withEvent:(UIEvent *)event{
[self.nextResponder manageTouches:touches];
}
-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
[self.nextResponder manageTouches:touches];
}
-(void) manageTouches:(NSSet *)touches{
for(UITouch *touch in touches){
if(touch.phase == UITouchPhaseBegan){
CGPoint touchPos = [touch locationInView:self.view];
startField.center = touchPos;
startField.text = [NSString stringWithFormat:@"Begin: %3.0f,%3.0f",touchPos.x,touchPos.y];
}
else if (touch.phase == UITouchPhaseMoved){
bottonLabel.text = @"Touch is Moving~";
}
else if (touch.phase == UITouchPhaseEnded){
if(touch.tapCount > 1){
bottonLabel.text = [NSString stringWithFormat:@"Taps: %2i",touch.tapCount];
}
else {
bottonLabel.text = [NSString string];
}
CGPoint touchPos = [touch locationInView:self.view];
endField.center = touchPos;
endField.text = [NSString stringWithFormat:@"End:%3.0f,%3.0f",touchPos.x,touchPos.y];
}
}
}
有几个警告
这是链接
--------------------编程问答-------------------- 你既然要用IB就要手动 连接
--------------------编程问答-------------------- 这个错误,应该是self.nextResponder 为 nil 造成的 --------------------编程问答-------------------- 2楼有道理
补充:移动开发 , iPhone