ScrollView代理方法的不准确目标contentoffset是iOS bug?
我有一个文本视图,其中设置了10000多行的内容,
- (void)viewDidLoad {
[super viewDidLoad];
self.textView.delegate = self;
NSMutableString *mustr = [[NSMutableString alloc]init];
for (int i = 0; i < 100000; i++) {
[mustr appendFormat:@"%i\n",i];
}
self.textView.text = mustr;
}
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset{
NSLog(@"Get expected stop position:Get expected stop position%f",willEndPoint.y);
}
我设置了一个按钮。停止后,我单击按钮以打印文本视图的真实偏移值,
- (IBAction)TESTBTN:(id)sender {
NSLog(@"Final roll stop position:%f",self.textView.contentOffset.y);
}
我发现您滑动越多,预期位置和实现位置之间的偏差就越大。有人知道发生了什么吗?是接口错误吗
I have a textview, in which I set more than 10000+ lines of content
- (void)viewDidLoad {
[super viewDidLoad];
self.textView.delegate = self;
NSMutableString *mustr = [[NSMutableString alloc]init];
for (int i = 0; i < 100000; i++) {
[mustr appendFormat:@"%i\n",i];
}
self.textView.text = mustr;
}
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset{
NSLog(@"Get expected stop position:Get expected stop position%f",willEndPoint.y);
}
I set a button. After stopping, I click the button to print the true offset value of textview
- (IBAction)TESTBTN:(id)sender {
NSLog(@"Final roll stop position:%f",self.textView.contentOffset.y);
}
I found that the more you slide, the greater the deviation between the expected position and the implementation position. Does anyone know what's going on? Is it an interface bug
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论