Question

I am currently developing an iOS 7 app. I would like to achieve a speech bubble-like UIToolBar view, to put some comments in. In stead of explaining a lot i will just post a couple of pictures (from Adobe Revel - the delete confirmation, and App Store - the search suggestions).

Sorry about having to link to the images, but i am new in here :)

Image of Adobe Revel
Image of App Store

It is not a possibility for me to create the bubble with an image, cause i would like the blurry transparent effect. I hope that someone has an an answer for this!

Thanks in advance.

Was it helpful?

Solution

What you are seeing there is the build in UIPopoverController. To make this effect on an iPad (it only works on iPads), simply take your view controller, and embed it in a UIPopoverController like so:

- (void)showViewControllerInPopover:(UIViewController *)viewController {
     self.popover = [[UIPopoverController alloc] initWithContentViewController:viewController];
     [self.popover presentPopoverFromBarButtonItem:self.barButton permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];     
}

Simply put whatever content you want in a custom view controller, and call the above method. Make sure to set the background of your view controller's view to clear.

Some Important Notes:

  • You will need to keep a reference to the popover controller. A property is usually the easiest way.
  • You can present from a UIBarButtonItem or a CGRect; whatever makes sense for your application.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top