-(instancetype)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ...
{
va_list args;
va_start(args, otherButtonTitles);
NSMutableArray *otherButtonsArray = [[NSMutableArray alloc] init];
for (NSString *arg = otherButtonTitles; arg != nil; arg = va_arg(args, NSString*))
{
[otherButtonsArray addObject:arg];
}
va_end(args);
if (POST_iOS8) {
#if __IPHONE_OS_VERSION_MAX_ALLOWED >70120
self = [super init];
alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
int buttonIndex = 0;
if(cancelButtonTitle)
{
CustomAlertAction *cancelAction =[CustomAlertAction actionWithTitle:cancelButtonTitle style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
if(delegate)
{
if ([delegate respondsToSelector:@selector(alertView:clickedButtonAtIndex:)]) {
[delegate alertView:self clickedButtonAtIndex:((CustomAlertAction*)action).buttonIndex];
}
}
}];
[cancelAction setButtonIndex:buttonIndex];
[alertController addAction:cancelAction];
buttonIndex++;
}
for (NSString *otherButton in otherButtonsArray)
{
CustomAlertAction *otherAction =[CustomAlertAction actionWithTitle:otherButton style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
if(delegate)
{
if ([delegate respondsToSelector:@selector(alertView:clickedButtonAtIndex:)]) {
[delegate alertView:self clickedButtonAtIndex:((CustomAlertAction*)action).buttonIndex];
}
}
}];
[otherAction setButtonIndex:buttonIndex];
[alertController addAction:otherAction];
buttonIndex++;
}
#endif
}
else
{
self = [super initWithTitle:title message:message delegate:delegate cancelButtonTitle:cancelButtonTitle otherButtonTitles:nil];
for (NSString *otherButton in otherButtonsArray)
{
[self addButtonWithTitle:otherButton];
}
}
return self;
}
I have designed to class to have common code along project to show alert with title, message, a button titles, Which is working fine with objective C code.
But I want to utilise the same code in one of my swift project, am unable to call this method and provide other button titles
Note that am unable to access like
CustomAlertView.initWithTitle......