tableVIew/scrollVIew,点击按钮滑倒最下/最上.

本文提供了一种高效的方法来实现iOS应用程序中滚动视图和表格视图的快速定位,包括如何跳转到视图的开头或结尾。通过使用Swift中的scrollRectToVisible(_:animated:)和scrollToRowAtIndexPath(atScrollPosition:animated:)方法,开发者可以轻松实现这一功能,为用户提供更流畅的用户体验。
//scrollVIew
1
//跳到最前 2 [_scrollView scrollRectToVisible:CGRectMake(0, 0, self.view.frame.size.width, 10) animated:YES]; 3 //跳到最后 4 [_scrollView scrollRectToVisible:CGRectMake(0, kHeight + 200 + _webView.frame.size.height, self.view.frame.size.width, kHeight + 250 + _webView.frame.size.height) animated:YES];
//tableView
1
//跳到最前 2 [_tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:YES]; 3 //跳到最后 4 [_tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:self.frameArray.count - 1 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];

 

转载于:https://www.cnblogs.com/kwame/p/3973276.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值