-(IBAction)_clickbtntablenextchapter:(id)sender
{
delegate.selectedChapter = [NSString stringWithFormat:@"%d",[delegate.selectedChapter intValue] + 1];
[delegate reloadVerses];
[self resetReadViewToVerse:1];
}
-(IBAction)_clickbtntableprvchapter:(id)sender
{
delegate.selectedChapter = [NSString stringWithFormat:@"%d",[delegate.selectedChapter intValue] - 1];
[delegate reloadVerses];
[self resetReadViewToVerse:1];
}
我只想在滑动功能中实现它。 提前致谢。 修改
-(void) handleSwipeGesture:(UISwipeGestureRecognizer*)recognizer {
// do whatever you need to do ...
delegate.selectedChapter = [NSString stringWithFormat:@"%d",[delegate.selectedChapter intValue] + 1];
[delegate reloadVerses];
[self resetReadViewToVerse:1];
}
-(void) handleSwipeGestureleft:(UISwipeGestureRecognizer*)recognizer {
// do whatever you need to do ...
delegate.selectedChapter = [NSString stringWithFormat:@"%d",[delegate.selectedChapter intValue] - 1];
[delegate reloadVerses];
[self resetReadViewToVerse:1];
}
this is gesture code and my button code is ,in button it works perfect.
-(IBAction)_clickbtntablenext:(id)sender
{
delegate.selectedChapter = [NSString stringWithFormat:@"%d",[delegate.selectedChapter intValue] + 1];
[delegate reloadVerses];
[self resetReadViewToVerse:1];
}
-(IBAction)_clickbtntableprevious:(id)sender
{
delegate.selectedChapter = [NSString stringWithFormat:@"%d",[delegate.selectedChapter intValue] - 1];
[delegate reloadVerses];
[self resetReadViewToVerse:1];
}
答案 0 :(得分:4)
在编辑模式下,滑动行为是默认的,您应该查看Inserting and Deleting Rows in Editing Mode。
如果您想拥有自己的行为,可以使用UISwipeGestureRecognizer来检测滑动。
编辑:
创建重新整理器:
UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeGesture:)];
swipeGesture.direction = UISwipeGestureRecognizerDirectionRight // or whatever
[cell addGestureRecognizer:swipeGesture];
[swipeGesture release];
实现目标的回调:
-(void) handleSwipeGesture:(UISwipeGestureRecognizer*)recognizer {
// do whatever you need to do ...
}