Question

UIActionSheet' was displaying properly in my one of the application until iOS 7 release. But now when I open UIActionSheet in iOS 7, it shows black line` on top corner of action sheet. As you can see in below image action sheet with black line in corners

After spending ample amount of time to find its reason, Finally I found that if we display UIActionSheet title (set title property with some text) then those black line removed by iOS 7. like image Action sheet with title

But As per requirement I don't want to display UIActionSheet title. So Is there any other approach to remove those black lines in corner? Or its an iOS 7 bug?

- (IBAction) showActionsheetWithoutTitle:(id)sender {
     UIActionSheet *actionsheet = [[UIActionSheet alloc]   initWithTitle:@""  delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Button1", @"Button2",@"Button3", nil];
     [actionsheet showInView:self.view];}
Was it helpful?

Solution

Replace @"" with nil for initWithTitle, as it takes a small gap between the title and other buttons:

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil
                                                         delegate:self
                                                cancelButtonTitle:nil
                                           destructiveButtonTitle:nil
                                                otherButtonTitles:@"Button1", @"Button2",@"Button3",  nil];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top