因爲UIAlertView
和UIActionsheet
已從iOS8中棄用。所以建議不要同時使用這兩個類。使用舊的動作表方法,我可以添加動態標籤for循環的幫助。UIAlertViewController類型的動作表與動態按鈕列表
UIActionSheet *actionSheet = [[UIActionSheet alloc]init];
actionSheet.title = @"Departure City";
actionSheet.delegate = self;
actionSheet.tag = 1;
for (int j =0 ; j<arrayDepartureList.count; j++)
{
NSString *titleString = arrayDepartureList[j];
[actionSheet addButtonWithTitle:titleString];
}
我可以使用按鈕索引在委託方法進行適當的action.This方法,我可以動態創建動作片。所以UIAlertController
課程是如何實現這一點的,我在問這個問題,因爲在UIAlertController
類中我們必須添加動作處理程序和動作塊。
你是怎麼做到這一點的? – Madhu
請參閱下面的接受的答案 – Vaibhav