haii У меня есть этот код в UISWitchControl для активации функции автопрокрутки
-(IBAction)_clickautoscroll:(id)sender
{
if(switchcontrolautoscroll.on){
if autoscrollTimer== nil) {
autoscrollTimer = [NSTimer scheduledTimerWithTimeInterval:(55.0/1000.0)
target:self
selector:@selector(autoscrollTimerFired:)
userInfo:nil
repeats:YES];
}
}
else{
[switchcontrolautoscroll setOn:NO animated:YES];
[autoscrollTimer invalidate];
[self.table scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:NO];
}
}
- (void)autoscrollTimerFired:(NSTimer*)timer {
CGPoint scrollPoint = self.table.contentOffset;
scrollPoint = CGPointMake(scrollPoint.x, scrollPoint.y + 1);
[self.table setContentOffset:scrollPoint animated:NO];
}
Работает нормально, но у меня есть распознаватель длинных жестов, чтобы завершить автопрокрутку, код
-(void) handleLongPressOnUndoGesture:(UILongPressGestureRecognizer*)recognizer {
//[switchcontrolautoscroll setOn:NO animated:YES];
[autoscrollTimer invalidate];
[self.table scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:NO];
}
но когда я нажимаю на кнопку, она останавливает автопрокрутку, но происходит сбой приложения.
есть ли дефект в моем коде.
Спасибо.