CGRect buttonFrame = CGRectMake( 10, 80, 100, 30 );
UIButton *button = [[UIButton alloc] initWithFrame: buttonFrame];
[button setTitle: @"Start" forState: UIControlStateNormal];
[button addTarget:self action:@selector(start_Accel) forControlEvents:UIControlEventTouchUpInside];
[button setTitle: @"Stop" forState: UIControlEventTouchUpInside];
[button addTarget:self action:@selector(stop_Accel) forControlEvents:UIControlEventTouchUpInside];
[view addSubview:button];
我想创建一个按钮,可以在用户按下它时启动和停止加速度计更新,但它的标题也应该从开始到停止更改,并且它应该继续直到用户通过另一个按钮重置所有内容,但我不知道得到它完成,除了以下代码,但它不会改变标题并调用停止动作?
先感谢您!