簡體   English   中英

如何在單擊時不關閉ActionSheet單元?

[英]How can I make an ActionSheet cell not dismiss when clicked?

我希望其中一個選項在單擊時不執行任何操作。 它基本上是一個占位符。 它沒有標題,只是白色。

func actionSheet(sheet: UIActionSheet, clickedButtonAtIndex buttonIndex: Int) {
    if sheet.tag == 1 {
        var title = sheet.buttonTitleAtIndex(buttonIndex)
        if title == Constants.EmptyTitleActionSheetItem{
               //do nothing. don't dismiss.
        }else{

               //something real was clicked. perform actions and continue dismissal
        }
    }
}

我看到有2個選擇。

  1. 正如我在上面的評論中提到的那樣,我認為避免解雇是不可能的。 另一種解決方案是,當您點擊了需要“不要關閉”的按鈕( animate = FALSE)時,可以再次顯示Action-Sheet。
  2. 您可以構建自己的actionSheet 使用第三方開源庫。

唯一的選擇是create a custom或使用third party

第三方行動表如下:

JGActionSheet-適用於iOS的功能豐富且現代的操作表。

AHKActionSheet-具有基於塊的API和可自定義外觀的UIActionSheet替代品。 受Spotify應用啟發。 實時顯示效果比在GIF上要好得多(由於壓縮)。

將return語句放在該if塊中。

if title == Constants.EmptyTitleActionSheetItem{
  //do nothing. don't dismiss.
    return;
    }

暫無
暫無

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

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