UIActionSheet is not showing separator on the last item on iOS 7 GM

Punty picture Punty · Sep 13, 2013 · Viewed 12.7k times · Source

It could be probably a bug on iOS7. But the last button is not separated from the previous oneUIActionSheet is missing separator on the last button

As you can see from the image. This happens on both Simulator and device using iOS7 GM. Does everyone else has the same problem?

UIActionSheet *actionSheet = [[UIActionSheet alloc]
               initWithTitle:@"Title"
               delegate:self
               cancelButtonTitle:nil
               destructiveButtonTitle:nil
               otherButtonTitles:@"First", @"Second", @"Third", @"Fourth", nil];
[actionSheet showInView:self.view];

As you can see the code is quite simple. Any idea on how to fix the problem? Or some third party library I can use instead of UIActionSheet ?

Answer

Yiding picture Yiding · Oct 4, 2013

I think ActionSheet requires a cancel button.So you can add the cancel button title.

Another way is: Specify actionSheet's cancelButtonIndex.

For example,in your case, you can add a "Cancel" in otherButtonTitles at index 4 and then specifiy actionSheet.cancelButtonIndex = 4.