Monday, May 23, 2011

CMPopTipView - new animation option

In December I introduced a custom iOS UIView: CMPopTipView, a view for presenting targeted tips or callout views.


CMPopTipView got a small update recently, a new presentation animation style submitted by myell0w.


The default animation style I originally implemented was a simple slide into place while fading in effect. Subtle, nice. This is still the default.


The new animation style option is a pop out style animation, like iOS UIAlertViews. This style could be useful when you need to catch the user's attention.


To enable the pop out style animation set the animation property to CMPopTipAnimationPop. For example:

CMPopTipView *popTipView = [[[CMPopTipView alloc] initWithMessage:@"My message"] autorelease];
popTipView.animation = CMPopTipAnimationPop;
popTipView.delegate = self;
[popTipView presentPointingAtView:button inView:self.view animated:YES];

Get CMPopTipView from github or read more details about this update from the pull request.

9 comments:

  1. This is great; just what I need to introduce a new feature whose existence isn't obvious.

    I would like a third presentation option, to put the tip in the middle of a UIView without pointing at anything. Suggestions on how to do that?

    ReplyDelete
  2. Hi Terry,

    You could add another presentation option to display the pop tip view centered within the specified UIView (implying no pointer being drawn). Something like:

    [popTipView presentCenteredInView:aView animated:YES];

    It would flag the pop tip view to center it in the containing view and not draw the pointer.

    If you do add something like that, send a pull request, I'd be happy to merge it in.

    Cheers,
    Chris

    ReplyDelete
  3. how to add existing uiview in it . pls explain me with basic coding sir.Plz reply me sir thx in advance

    ReplyDelete
    Replies
    1. You can show a view within a pop tip view by initialising it with initWithCustomView:.

      Look at the demo app source for an example of this.

      Cheers,
      Chris

      Delete
  4. Chris,

    Nice job on this Popup. I have integrated your control into my new app Piik (http://piik.me). Looking forward to see more enhancement.

    Thanks,
    Derek

    ReplyDelete
  5. Thanks for the great popup!

    But how can I show the popup from the accessory button (UITableViewCellAccessoryDetailDisclosureButton) in my tableview?

    I tried this code, but i doesn't work :(

    [myPopUp presentPointingAtView:cell.accessoryView inView:self.view animated:YES ];

    Thanks for any help!

    ReplyDelete
  6. Hi Chris!

    Great job!

    What if I want to create my own custom UIView?

    What should I write in alloc initWithFrame = what is the frame size?

    ReplyDelete
  7. The frame should contain the required size of your custom view, with origin 0,0.

    ReplyDelete