gpt4 book ai didi

IOS 7 如何使用 UITableView scrollToRowAtIndexPath

转载 作者:行者123 更新时间:2023-11-29 10:46:50 32 4
gpt4 key购买 nike

我是 IOS 7 的新手,我制作了一个测试应用程序,我想在检测到向左滑动时使用 scrollToRowAtIndexPath。检测到滑动,但我正在为“ self ”定义而苦苦挣扎。我收到错误消息 No visible @interface for 'SimpleTableViewController'

- (void)handleSwipeLeft:(UISwipeGestureRecognizer *)recognizer
{
NSLog(@"%u = %d", recognizer.direction,recognizer.state);

// jump to section 0 row 20 when leftswipe is dectected
NSIndexPath *newIndexPath = [NSIndexPath indexPathForRow:20 inSection:0];

[self.tableView scrollToRowAtIndexPath:newIndexPath atScrollPosition:UITableViewScrollPositionTop animated:NO];

}

我可以把完整的源代码发给你,或者你可以在这里下载:

www.auditext.com/xintax/SimpleTable.zip

使用 self.tableView 给出消息 Property 'tableView' not found on object of type 'SimpleTableViewController' –

现在可以使用了,我已将这一行添加到我的 viewcontroller.h 中:`@property (strong, nonatomic) IBOutlet UITableView *myview;

NSIndexPath *loc = [NSIndexPath indexPathForRow:row inSection:section];

[self.myview scrollToRowAtIndexPath:loc atScrollPosition:UITableViewScrollPositionBottom animated:YES];`

最佳答案

你需要指向UItableView

[self.tableView scrollToRowAtIndexPath:newIndexPath 
atScrollPosition:UITableViewScrollPositionTop
animated:NO];

enter image description here

关于IOS 7 如何使用 UITableView scrollToRowAtIndexPath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22119086/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com