0

我在为动作选择器项目的按钮设置标题时遇到了麻烦。

ActionSheetMultipleStringPicker.show(withTitle: "Select Nationality",  rows: [
        nationalityArray], initialSelection: [selectedNationalityIdStr],
                        doneBlock: {
                            picker, indexes, values in

                            let selectedEmirate = "\(values)"

                            self.btnNationality.setTitle(selectedEmirate, for: .normal)

                            print("values = \(values)")
                            print("indexes = \(finalIntId)")
                            print("picker = \(picker)")

                            return
    }, cancel:
        {
            ActionMultipleStringCancelBlock in return

    }, origin: sender)

操作表选择器内的值的打印是这样的

values = Optional(<__NSSingleObjectArrayI 0x600001ba1740>(Expat)

所以当我在下面写这行来为 UIButton 设置标题时,它正在设置整个

 self.btnNationality.setTitle("\(selectedEmirate)", for: .normal)

正如您在此处看到的,它采用整个值字符串,而不仅仅是“expat”: 在此处输入图像描述

请有人帮我从我的操作表选择器的值中只设置“外籍人士”

4

0 回答 0