【发布时间】:2015-11-26 06:07:23
【问题描述】:
我将使用 UIAlertController 让用户选择一项。 要选择的项目如下:
let arraySelect = ["NewYork", "Washington", "Seoul", "Tokyo", "Peking", "Sidney", ... ]
let alert = UIAlertController(title: nil, message: nil, preferredStyle: .Alert)
// Add items in array to Alert
for var i = 0; i < arraySelect.count; i++ {
alert.addAction(UIAlertAction(title: arrayBibleVersions[i], style: .Default, handler: {(_) in }))
}
// Add cancel button.
alert.addAction(UIAlertAction(title: "취소", style: .Cancel, handler: {(_) in }))
self.presentViewController(alert, animated: false, completion: nil)
当用户触摸一个项目时,我必须获取用户触摸的项目的索引。 但我不知道如何获取索引.. 请帮帮我。
【问题讨论】:
标签: swift indexing uialertcontroller