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

      • <bdo id='Ab2WA'></bdo><ul id='Ab2WA'></ul>
    1. <tfoot id='Ab2WA'></tfoot>
    2. <i id='Ab2WA'><tr id='Ab2WA'><dt id='Ab2WA'><q id='Ab2WA'><span id='Ab2WA'><b id='Ab2WA'><form id='Ab2WA'><ins id='Ab2WA'></ins><ul id='Ab2WA'></ul><sub id='Ab2WA'></sub></form><legend id='Ab2WA'></legend><bdo id='Ab2WA'><pre id='Ab2WA'><center id='Ab2WA'></center></pre></bdo></b><th id='Ab2WA'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Ab2WA'><tfoot id='Ab2WA'></tfoot><dl id='Ab2WA'><fieldset id='Ab2WA'></fieldset></dl></div>
    3. <legend id='Ab2WA'><style id='Ab2WA'><dir id='Ab2WA'><q id='Ab2WA'></q></dir></style></legend>

        <small id='Ab2WA'></small><noframes id='Ab2WA'>

        如何正確使用 swipeWithEvent 導航 webView,Obj-C

        How to properly use swipeWithEvent to navigate a webView, Obj-C(如何正確使用 swipeWithEvent 導航 webView,Obj-C)

        1. <tfoot id='8FpuI'></tfoot>
          <i id='8FpuI'><tr id='8FpuI'><dt id='8FpuI'><q id='8FpuI'><span id='8FpuI'><b id='8FpuI'><form id='8FpuI'><ins id='8FpuI'></ins><ul id='8FpuI'></ul><sub id='8FpuI'></sub></form><legend id='8FpuI'></legend><bdo id='8FpuI'><pre id='8FpuI'><center id='8FpuI'></center></pre></bdo></b><th id='8FpuI'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='8FpuI'><tfoot id='8FpuI'></tfoot><dl id='8FpuI'><fieldset id='8FpuI'></fieldset></dl></div>
        2. <legend id='8FpuI'><style id='8FpuI'><dir id='8FpuI'><q id='8FpuI'></q></dir></style></legend>

              <small id='8FpuI'></small><noframes id='8FpuI'>

                <tbody id='8FpuI'></tbody>

                • <bdo id='8FpuI'></bdo><ul id='8FpuI'></ul>
                • 本文介紹了如何正確使用 swipeWithEvent 導航 webView,Obj-C的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我想通過使用事件 swipeWithEvent 來實現在我的 webView 中向后和第四次導航的功能.但是,我不知道我應該如何使用它.

                  I want to implement the ability to navigate back and fourth in my webView by using the Event swipeWithEvent. However, I have no idea how I am suppose to use this.

                  我有一個主要的 webView,以及向后和第四個導航的兩種方法.這里的一個大問題是我不確定如何寫這個問題.我只需要知道如何識別我的 webView 上的滑動手勢并調用我的兩個方法.類似于 Safari、Google Chrome 和 Mozilla Firefox 所做的事情.謝謝.

                  I have one main webView, and two methods that navigate back and fourth. A big problem here is that I'm not exactly sure how to write this question. I just need to know how to recognize swipe gestures on my webView and call my two methods. Similar to what Safari, Google Chrome, and Mozilla Firefox do. Thanks.

                  編輯我已經實現了這些方法,這些方法可以讓我前后滑動.

                  EDIT I have implemented these methods which are suppose to allow me to swipe back and forward.

                  - (void)swipeWithEvent:(NSEvent *)event {
                      NSLog(@"Swipe With Event");
                      CGFloat x = [event deltaX];
                      //CGFloat y = [event deltaY];
                  
                      if (x != 0) {
                          (x > 0) ? [self goBack:self] : [self goForward:self];
                      }
                  }
                  
                  
                  -(BOOL)recognizeTwoFingerGestures
                  {
                      NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
                      return [defaults boolForKey:@"AppleEnableSwipeNavigateWithScrolls"];
                  }
                  
                  - (void)beginGestureWithEvent:(NSEvent *)event
                  {
                      if (![self recognizeTwoFingerGestures])
                          return;
                  
                      NSSet *touches = [event touchesMatchingPhase:NSTouchPhaseAny inView:nil];
                  
                      self.twoFingersTouches = [[NSMutableDictionary alloc] init];
                  
                      for (NSTouch *touch in touches) {
                          [twoFingersTouches setObject:touch forKey:touch.identity];
                      }
                  }
                  
                  - (void)endGestureWithEvent:(NSEvent *)event
                  {
                      if (!twoFingersTouches) return;
                  
                      NSSet *touches = [event touchesMatchingPhase:NSTouchPhaseAny inView:nil];
                  
                      // release twoFingersTouches early
                      NSMutableDictionary *beginTouches = [twoFingersTouches copy];
                      self.twoFingersTouches = nil;
                  
                      NSMutableArray *magnitudes = [[NSMutableArray alloc] init];
                  
                      for (NSTouch *touch in touches)
                      {
                          NSTouch *beginTouch = [beginTouches objectForKey:touch.identity];
                  
                          if (!beginTouch) continue;
                  
                          float magnitude = touch.normalizedPosition.x - beginTouch.normalizedPosition.x;
                          [magnitudes addObject:[NSNumber numberWithFloat:magnitude]];
                      }
                  
                      // Need at least two points
                      if ([magnitudes count] < 2) return;
                  
                      float sum = 0;
                  
                      for (NSNumber *magnitude in magnitudes)
                          sum += [magnitude floatValue];
                  
                      // Handle natural direction in Lion
                      BOOL naturalDirectionEnabled = [[[NSUserDefaults standardUserDefaults] valueForKey:@"com.apple.swipescrolldirection"] boolValue];
                  
                      if (naturalDirectionEnabled)
                          sum *= -1;
                  
                      // See if absolute sum is long enough to be considered a complete gesture
                      float absoluteSum = fabsf(sum);
                  
                      if (absoluteSum < kSwipeMinimumLength) return;
                  
                      // Handle the actual swipe
                      if (sum > 0)
                      {
                          [self goForward:self];
                      } else
                      {
                          [self goBack:self];
                      }
                  
                  
                  }
                  

                  但是,這段代碼沒有做任何事情.它似乎根本沒有被調用.

                  However, this code isn't doing anything. It doesn't appear to be getting called at all.

                  推薦答案

                  對于現代操作系統(Lion 和更新的操作系統),這是我如何用 Y 做 X?"的問題之一.答案是不要使用 Y"的問題.

                  For modern OSes (Lion and newer), this is one of those "How do I do X with Y?" questions where the answer is "Don't use Y."

                  -swipeWithEvent: 用于實現 10.6 風格的觸控板滑動,屏幕上的內容不會隨著滑動而移動.大多數 Mac 觸控板不再配置為允許這種滑動;觸控板偏好面板中的在頁面之間滑動"首選項必須設置為用三個手指滑動"才能使用,這既不是默認設置,也不是用戶可以更改的常用設置.

                  -swipeWithEvent: is used to implement 10.6-style trackpad swiping, where the content on the screen doesn't move with the swipe. Most Mac trackpads are not configured to allow this kind of swiping anymore; the "Swipe between pages" preference in Trackpad pref pane has to be set to "swipe with three fingers" for it to be available, and that's neither the default setting nor a common setting for users to change.

                  Lion 風格的流暢滑動"作為滾動事件出現.Xcode SDK 中的 PictureSwiper 示例項目是一個很好的起點,但作為概述,您可以這樣做:

                  Lion-style "fluid swipes" instead come in as scroll events. The PictureSwiper sample project in your Xcode SDK is a good place to start, but as an overview, here's what you do:

                  如果只需要支持10.8+

                  在歷史堆棧模式下使用 NSPageController.

                  Use an NSPageController in history stack mode.

                  如果需要支持 10.7

                  1. 認真考慮僅支持 10.8+,至少對于此功能.手動實現它是一個巨大的混亂.別說我沒有警告你.

                  1. Seriously consider supporting only 10.8+, at least for this feature. Implementing it manually is a huge mess. Don't say I didn't warn you.

                  創建一個自定義視圖,它是您希望可滑動的任何視圖的超級視圖.

                  Create a custom view that is a superview to whatever views you want to be swipeable.

                  覆蓋 -wantsScrollEventsForSwipeTrackingOnAxis: 以返回相應軸的 YES.如果您正在執行 Safari 風格的后退/前進導航,那就是 NSEventGestureAxisHorizo??ntal.

                  Override -wantsScrollEventsForSwipeTrackingOnAxis: to return YES for the appropriate axis. If you're doing Safari-style back/forward navigation, that's NSEventGestureAxisHorizontal.

                  深呼吸;這個太棒了.

                  在您的自定義視圖中覆蓋 -scrollWheel:.您的覆蓋應該調用 -trackSwipeEventWithOptions:dampenAmountThresholdMin:max:usingHandler:.粗略地說,衰減量閾值最小值是用戶可以向左滑動的數據瀏覽量,最大值是他們可以向右滑動的數據量.處理程序是一個在用戶滑動時重復調用的塊;它應該:

                  Override -scrollWheel: in your custom view. Your override should call -trackSwipeEventWithOptions:dampenAmountThresholdMin:max:usingHandler:. Roughly, the dampen amount threshold minimum is how many viewfuls of data the user can swipe to the left, and the maximum is how many they can swipe to the right. The handler is a block that's called repeatedly as the user swipes; it should:

                  1. 在內容視圖后面放置一個 NSImageView,其中包含您要返回/前進到的頁面的屏幕截圖.
                  2. 移動內容視圖以匹配用戶的動作.請注意,gestureAmount 參數與阻尼量閾值一樣,是項目的(小數,可能是負數)數量;您必須將其乘以視圖寬度才能正確定位內容視圖.
                  3. 如果手勢階段是 NSEventPhaseEnded,則評估 gestureAmount 以確定用戶是否完成了手勢.如果他們沒有,將內容視圖動畫化回原位;如果他們這樣做了,請將內容視圖放回原位,不使用動畫并更新它以匹配屏幕截圖.
                  1. Place an NSImageView with a screenshot of the page you're going back/forward to behind your content view.
                  2. Move the content view to match the user's movements. Note that the gestureAmount parameter is, like the dampen amount thresholds, a (fractional and possibly negative) number of items; you have to multiply it by the view width to correctly position the content view.
                  3. If the gesture phase is NSEventPhaseEnded, evaluate the gestureAmount to determine if the user completed the gesture. If they didn't, animate the content view back into place; if they did, put the content view back in place with no animation and update it to match the screenshot.

                  如您所見,實際實現處理程序非常復雜,我什至沒有描述所有細節.即使有了所有這些細節,一個技術高超的程序員也可能需要花幾天時間才能做到這一點.10.7 SDK 中的 PictureSwiper 示例是一個很好的起點.(PictureSwiper 10.8 版本使用 NSPageController.就像你應該做的那樣.)

                  As you can see, actually implementing the handler is very involved, and I haven't even described all of the specifics. Even with all of these details, a highly skilled programmer will probably have to spend a few days getting this just right. The PictureSwiper sample in the 10.7 SDK is a good place to start. (The 10.8 version of PictureSwiper uses NSPageController. Just like you ought to do.)

                  這篇關于如何正確使用 swipeWithEvent 導航 webView,Obj-C的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  How to get Location (latitude amp; longitude value) in variable on iOS?(如何在 iOS 上的變量中獲取位置(緯度和經度值)?)
                  iOS 8 requestWhenInUseAuthorization no Popup(iOS 8 requestWhenInUseAuthorization 沒有彈出)
                  Calculate new coordinate x meters and y degree away from one coordinate(計算距離一個坐標的新坐標 x 米和 y 度)
                  Get row index of custom cell in UITableview(獲取 UITableview 中自定義單元格的行索引)
                  ios tabbar put text in the middle when no image(ios標簽欄在沒有圖像時將文本放在中間)
                  respondsToSelector fails for appearance proxy(respondsToSelector 外觀代理失敗)
                      <tbody id='jIOPe'></tbody>
                    <tfoot id='jIOPe'></tfoot>
                      <bdo id='jIOPe'></bdo><ul id='jIOPe'></ul>
                      <i id='jIOPe'><tr id='jIOPe'><dt id='jIOPe'><q id='jIOPe'><span id='jIOPe'><b id='jIOPe'><form id='jIOPe'><ins id='jIOPe'></ins><ul id='jIOPe'></ul><sub id='jIOPe'></sub></form><legend id='jIOPe'></legend><bdo id='jIOPe'><pre id='jIOPe'><center id='jIOPe'></center></pre></bdo></b><th id='jIOPe'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='jIOPe'><tfoot id='jIOPe'></tfoot><dl id='jIOPe'><fieldset id='jIOPe'></fieldset></dl></div>
                      1. <small id='jIOPe'></small><noframes id='jIOPe'>

                        <legend id='jIOPe'><style id='jIOPe'><dir id='jIOPe'><q id='jIOPe'></q></dir></style></legend>

                          • 主站蜘蛛池模板: 99re99| 国产久视频 | 精品久久久久香蕉网 | 99色视频| 欧美成人自拍视频 | 久久国产激情视频 | 网黄在线 | 免费精品| 少妇一级淫片aaaaaaaaa | 亚洲国产欧美日韩 | 色综合视频 | 毛片一区二区三区 | 欧美国产视频 | 久久久久久网 | 久久久久国色av免费观看性色 | 欧美日韩在线一区 | 国产精品成人一区二区三区夜夜夜 | 在线三级电影 | 欧美一区二区大片 | 综合久久久 | 日韩在线欧美 | 99精品亚洲国产精品久久不卡 | 中文字幕在线视频免费视频 | 视频在线观看一区二区 | 国产精品中文字幕在线播放 | 国产精品国产精品国产专区不片 | 中文字幕av网站 | 日本在线免费视频 | 国产区在线视频 | a级在线免费视频 | 午夜电影网站 | 黄色大全免费看 | 亚洲成av | 国产精品一区二区三区四区五区 | 中文字幕亚洲一区 | 国产一区二区三区不卡av | 久久噜噜噜精品国产亚洲综合 | 三级免费av | 国产精品国产馆在线真实露脸 | 国产在线一区二区三区 | 国产精品久久久精品 |