久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

scrollViewWillEndDragging:withVelocity:targetContentOffset: 不

scrollViewWillEndDragging:withVelocity:targetContentOffset: not working on the edges of a UISCrollView(scrollViewWillEndDragging:withVelocity:targetContentOffset: 不在 UISCrollView 的邊緣工作) - IT屋-程序員軟件開發技術分享社
本文介紹了scrollViewWillEndDragging:withVelocity:targetContentOffset: 不在 UISCrollView 的邊緣工作的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在嘗試實現一個可滾動的自定義標簽欄,并且在每個標簽欄項目上都有分頁.為此,我正在使用委托 scrollViewWillEndDragging:withVelocity:targetContentOffset: 它完美地解決了一個問題.

I'm trying to implement a custom tab bar which is scrollable and has paging at each tab bar item. For that i'm using the delegate scrollViewWillEndDragging:withVelocity:targetContentOffset: which works perfectly with one problem.

我的分頁工作方式是,如果 contentOffset 靠近正確的項目,則 targetContentOffset 會更改為該項目的偏移量.左側也一樣.

The way my paging works is, if the contentOffset is near the right item, it the targetContentOffset changes to the offset of that item. Same thing for the left side.

問題是,每當我在第一個項目的左半部分和最后一個項目的右側(滾動視圖水平工作)時,它應該轉到 ContentOffset 0 和最右邊項目的內容偏移量(減去屏幕上的那些),但它沒有.

The problem is, whenever I'm at at the left half of the first item and the right of the last (the scroll view works horizontally) it's supposed to go to ContentOffset 0 and the content offset of the rightmost item (minus the ones on screen), but it doesn't.

我檢查了調試器,targetContentOffset->x 確實為 0(在第一種情況下 - 最左邊的項目的左側).所以問題是 UIScrollView 沒有在那里滾動.我迷路了.

I checked with the debugger and the targetContentOffset->x is indeed 0 (in the first case - left of the leftmost item). So the problem is the UIScrollView not scrolling there. I'm lost.

這是我實現的委托:

- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView
                 withVelocity:(CGPoint)velocity
          targetContentOffset:(inout CGPoint *)targetContentOffset{
     NSInteger index = lrintf(targetContentOffset->x/self.tabWidth);
     targetContentOffset->x = index * self.tabWidth;
}

這是解釋我想要做什么的圖表.

Here is the diagram explaining what i want to do.

|-------|-------|-------|-------|-------|-------|-------|
|       |       |       |       |       |       |       |
|       |       |       |       |       |       |       |
|_______|_______|_______|_______|_______|_______|_______|

        |_______________________________________|
         where it is and i scroll it to the left

   <----|

   |_______________________________________|
              where it would stop

|_______________________________________|
        where i want it to stop

推薦答案

這似乎是一個已知問題.經過一番調查并與其他人交談后,有人建議這可能是一個錯誤,結果證明是正確的.我向 Apple 報告了它,它是否被標記為重復但仍處于打開狀態.只為遇到同樣問題的人解答.我像 Big Papoo 建議的那樣解決它,通過使用接近我想要的偏移量(0.1 似乎可以做到).右端也一樣.

This is a known issue it seems. After some investigation and talking to other people it was suggested it could be a bug, which turned out to be correct. I reported it to Apple and was it marked as duplicate but is still open. Just answering for those of you with the same problem. I workaround it like Big Papoo suggests, by using an offset close to what I want (0.1 seems to do it). The same for the right end.

這篇關于scrollViewWillEndDragging:withVelocity:targetContentOffset: 不在 UISCrollView 的邊緣工作的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

UIButtons at the bottom of UIScrollView not working(UIScrollView 底部的 UIButtons 不起作用)
ImageView Scaling when scrolling down(向下滾動時 ImageView 縮放)
Bounds automatically changes on UIScrollView with content insets(UIScrollView 上的邊界自動更改,帶有內容插圖)
iOS5 UITapRecognizer for UIScrollView interfering with buttons. How to fix?(用于 UIScrollView 的 iOS5 UITapRecognizer 干擾按鈕.怎么修?)
Handling scroll views with (custom, interactive) view controller presentation and dismissal(使用(自定義、交互式)視圖控制器呈現和解除處理滾動視圖)
How to Cancel Scrolling in UIScrollView(如何在 UIScrollView 中取消滾動)
主站蜘蛛池模板: 久操亚洲 | 成人激情视频在线观看 | 日韩欧美在线观看视频 | 中文字幕一区在线 | 成人激情视频网 | 亚洲女人天堂网 | 人人玩人人添人人澡欧美 | 色久在线 | 99色在线视频 | 欧美日韩理论 | 福利视频一区二区三区 | 在线男人天堂 | 久久久看 | 一级久久久久久 | 国产日韩久久久久69影院 | 精品日韩在线 | 国产一级特黄aaa大片评分 | 免费的av网站 | 国产午夜视频 | 天天射影院 | 蜜桃免费一区二区三区 | 婷婷久久精品一区二区 | 日韩中文字幕在线观看 | 91精品久久久| 久久av网 | 蜜桃av鲁一鲁一鲁一鲁 | 色香蕉在线 | 视频1区2区 | 亚洲国产精品久久久 | 成人性视频在线 | 亚洲伦理自拍 | 亚洲一区精品在线 | 日本网站在线看 | 久久艹av | 国产精品美女久久久久久久网站 | 美女一区二区在线观看 | 天天综合网7799精品 | 久久精品久久综合 | 天天躁人人躁人人躁狂躁 | 日本精品一区二区三区四区 | 羞羞视频免费观 |