簡體   English   中英

我可以同時使用Threading進行拖動和UIButton事件嗎?

[英]Can I use Threading for dragging and UIButton event simultaneously?

我的iPad應用程序具有自定義用戶界面,並且同時拖動對象和按鈕事件。 我的問題是,當我拖動對象時,動畫開始工作,而當我離開對象時,動畫仍在工作一段時間。 同時,當我嘗試按下按鈕或拖動另一個對象時,它直到動畫完成才起作用。

如果要與正在動畫的UIButton交互:
使用(核心)動畫; 您不能在元素的動畫周期內(常規方式)與它們進行交互。 只有完成動畫后,您才能再次與他們互動。 您可以在主視圖上創建自己的觸摸處理程序,以檢查觸摸是否位於動畫按鈕的“附近”。

如果您想與“休息”互動:
確保使用UIViewAnimationOptionAllowUserInteraction參數為對象設置動畫:

During an animation, user interactions are temporarily disabled for the views being animated. (Prior to iOS 5, user interactions are disabled for the entire application.) If you want users to be able to interact with the views, include the UIViewAnimationOptionAllowUserInteraction constant in the options parameter.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM