Since UIAlertView
they UIActionsheet
are deprecated from iOS 8. Therefore, it is recommended not to use both of these two classes. Using the old action method, I could dynamically add tabs using a for loop.
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];
}
and I can use the button index in the delegate method to perform the appropriate actions. This way I can create an action sheet on the fly. Therefore, with the class UIAlertController
, how this can be achieved, I ask about it, because in the class UIAlertController
we have to add action handlers with their action block.
source
share