From 7882a096052b66735c61bb9be256d23fd3e46bea Mon Sep 17 00:00:00 2001 From: Simon Holroyd Date: Fri, 10 May 2013 11:18:47 -0400 Subject: [PATCH] Bugfixing addButtonWithTitle after 0 buttons passed in init --- TTAlertView/TTAlertView.m | 1 + 1 file changed, 1 insertion(+) diff --git a/TTAlertView/TTAlertView.m b/TTAlertView/TTAlertView.m index 37773f6..90664d5 100644 --- a/TTAlertView/TTAlertView.m +++ b/TTAlertView/TTAlertView.m @@ -269,6 +269,7 @@ - (void)addButtonWithTitle:(NSString *)title [otherButton addTarget:self action:@selector(otherButtonAction:) forControlEvents:UIControlEventTouchUpInside]; [otherButton setTitle:title forState:UIControlStateNormal]; [self.containerView addSubview:otherButton]; + if (self.firstOtherButtonIndex < 0) _firstOtherButtonIndex = MAX(_cancelButtonIndex, 0) + 1; [self.buttons insertObject:otherButton atIndex:([self.buttons count] - 1) + self.firstOtherButtonIndex]; if(self.isVisible) {