0

I would like to create something like this: enter image description here

The copy, star, reply, details. Is this just a UIPopover with a segmented button on it?

Here's another example of what I want: enter image description here

Anyone got something like this?

aherlambang
  • 14,290
  • 50
  • 150
  • 253

2 Answers2

0

No. Ive been trying to recreate that view with a UIPopoverViewcontroller, holding a UIViewController with a UISegment.. and Im not getting that same functionality. The main issue is the UIPopoverVC is giving me a 3d border around my viewcontroller/view.

It does appear that its a custom view. Which, on that note, would not be too difficult to create by the way, and that view can host your SegmentedViewController, just not in a UIPopoverVC.

And.. for your viewing enjoyment... here is the code that creates the CGPath for a "Balloon" view like the Popover creates. this code goes in your drawRect.

    float radius=5; //corner radius
    CGContextSaveGState(context);


    CGContextBeginPath(context);
    CGContextSetRGBFillColor(context, backColor.red,backColor.green,backColor.blue,backColor.alpha);


    CGContextMoveToPoint(context, CGRectGetMinX(rect) + radius, CGRectGetMinY(rect));
    CGContextAddArc(context, CGRectGetMaxX(rect) - radius, CGRectGetMinY(rect) + radius, radius, 3 * M_PI / 2, 0, 0);
    CGContextAddArc(context, CGRectGetMaxX(rect) - radius, CGRectGetMaxY(rect) - radius, radius, 0, M_PI / 2, 0);
    CGContextAddArc(context, CGRectGetMinX(rect) + radius, CGRectGetMaxY(rect) - radius, radius, M_PI / 2, M_PI, 0);
    CGContextAddArc(context, CGRectGetMinX(rect) + radius, CGRectGetMinY(rect) + radius, radius, M_PI, 3 * M_PI / 2, 0);    

    CGContextMoveToPoint(context, rect.size.width/2, rect.size.height);
    CGContextAddLineToPoint(context, rect.size.width/2, rect.size.height+10);
    CGContextAddLineToPoint(context, rect.size.width/2+10, rect.size.height);

    CGContextClosePath(context);

    CGContextFillPath(context);

    CGContextRestoreGState(context);
Jason Cragun
  • 3,233
  • 1
  • 26
  • 27
  • hmm...got confused here, so what did you use in the end? – aherlambang May 09 '11 at 04:41
  • sorry... to get the exact experience.. create your own view, have that view draw itself in what I call the "Balloon View", I added code above that creates the path for that view. You will still need to style that view. Have your Balloon view host a UISegmentedView. Then, just pop open the Balloon view on your own, without using the Popover VIew Controller. – Jason Cragun May 09 '11 at 04:44
  • so you're suggesting not to use the popupviewcontroller, then how do you show it? how do you pop open the Ballon view on your own? an example would help – aherlambang May 09 '11 at 05:19
0

The class you are looking for is UIMenuController

This SO page has a lot of useful information.

Community
  • 1
  • 1
arrtchiu
  • 1,076
  • 1
  • 10
  • 23