1

I need to show dialog in my iPhone/iPad app (kind of like in Photos, left bottom button which opens dialog with choices "Email Photo", "MMS", "Assign to Contact", "Use a Wallpaper", etc...) -- is it possible? How this view element is called?

And the second questions - is somewhat related. One of the options would be "Email Current Screen", which needs to make screenshot of current screen (obviously without this dialog :-) and open in email to send an email. Please suggest how can I make screenshot? I force it to attach to the email? Thanks!

alexeypro
  • 3,633
  • 7
  • 36
  • 49

3 Answers3

2

To your first question: it's called an action sheet, and is represented by the UIActionSheet class. On the iPhone, you can display it in your view using its -showInView: method; on the iPad, you can display it from a toolbar button with the -showFromBarButtonItem:animated: method, or from an arbitrary rectangle in a view with -showFromRect:inView:animated:. Note that since these are two separate code paths, you'll want to use the UI_USER_INTERFACE_IDIOM() macro (Google it) to determine what type of device your code's running on.

Noah Witherspoon
  • 57,021
  • 16
  • 130
  • 131
0

here is the question which deals with taking the screen shot

How to capture current view screenshot and reuse in code? (iPhone SDK)

Community
  • 1
  • 1
Vaibhav Tekam
  • 2,344
  • 3
  • 18
  • 27
0

Here's the answer, in MonoTouch (.NET):

    public class ScreenShot
{
    public static UIImage TakeScreenShot (UIView view)
    {
        RectangleF canvasRect = view.Bounds;
        UIGraphics.BeginImageContext (canvasRect.Size);

        CGContext ctx = UIGraphics.GetCurrentContext ();
        ctx.FillRect (canvasRect);
        view.Layer.RenderInContext (ctx);

        UIImage newImage = UIGraphics.GetImageFromCurrentImageContext ();

        UIGraphics.EndImageContext ();

        return newImage;
    }
}
Ian Vink
  • 66,960
  • 104
  • 341
  • 555