项目作者: NAXAM

项目描述 :
Xamarin Binding Library - CMPopTipView for iOS
高级语言: C#
项目地址: git://github.com/NAXAM/cmpoptipview-ios-binding.git
创建时间: 2017-07-13T09:58:14Z
项目社区:https://github.com/NAXAM/cmpoptipview-ios-binding

开源协议:MIT License

下载


CMPopTipView - Xamarin iOS Binding Library

An iOS UIView subclass that displays a rounded rect “bubble”, containing
a text message, pointing at a specified button or view.

A CMPopTipView will automatically position itself within the view so that
it is pointing at the specified button or view, positioning the “pointer”
as necessary.

A CMPopTipView can be pointed at any UIView within the containing view.
It can also be pointed at a UIBarButtonItem within either a UINavigationBar
or a UIToolbar and it will automatically position itself to point at the
target.

The background and text colors can be customised if the defaults are not
suitable.

Two animation options are available for when a CMPopTipView is presented:
“slide” and “pop”.

A CMPopTipView can be dismissed by the user tapping on it. It can also
be dismissed programatically.

CMPopTipView is rendered entirely by Core Graphics.

Screenshots



Videos

http://www.youtube.com/watch?v=nul9VA_QsGI

Usage

Example 1 - point at a UIBarButtonItem in a nav bar:

  1. // Present a CMPopTipView pointing at a UIBarButtonItem in the nav bar
  2. CMPopTipView *navBarLeftButtonPopTipView = [[CMPopTipView alloc] initWithMessage:@"A Message"];
  3. navBarLeftButtonPopTipView.delegate = self;
  4. [navBarLeftButtonPopTipView presentPointingAtBarButtonItem:self.navigationItem.leftBarButtonItem animated:YES];
  5. // Dismiss a CMPopTipView
  6. [navBarLeftButtonPopTipView dismissAnimated:YES];
  7. // CMPopTipViewDelegate method
  8. - (void)popTipViewWasDismissedByUser:(CMPopTipView *)popTipView {
  9. // any code
  10. }

Example 2 - pointing at a UIButton, with custom color scheme::

  1. - (IBAction)buttonAction:(id)sender {
  2. // Toggle popTipView when a standard UIButton is pressed
  3. if (nil == self.roundRectButtonPopTipView) {
  4. self.roundRectButtonPopTipView = [[CMPopTipView alloc] initWithMessage:@"My message"];
  5. self.roundRectButtonPopTipView.delegate = self;
  6. self.roundRectButtonPopTipView.backgroundColor = [UIColor lightGrayColor];
  7. self.roundRectButtonPopTipView.textColor = [UIColor darkTextColor];
  8. UIButton *button = (UIButton *)sender;
  9. [self.roundRectButtonPopTipView presentPointingAtView:button inView:self.view animated:YES];
  10. }
  11. else {
  12. // Dismiss
  13. [self.roundRectButtonPopTipView dismissAnimated:YES];
  14. self.roundRectButtonPopTipView = nil;
  15. }
  16. }
  17. #pragma mark CMPopTipViewDelegate methods
  18. - (void)popTipViewWasDismissedByUser:(CMPopTipView *)popTipView {
  19. // User can tap CMPopTipView to dismiss it
  20. self.roundRectButtonPopTipView = nil;
  21. }

Available Options

  • id < CMPopTipViewDelegate > delegate
  • UIColor *backgroundColor
  • BOOL disableTapToDismiss
  • BOOL dismissTapAnywhere
  • NSString *title
  • NSString *message
  • UIView *customView
  • id targetObject
  • UIColor *titleColor
  • UIFont *titleFont
  • UIColor *textColor
  • UIFont *textFont
  • NSTextAlignment titleAlignment
  • NSTextAlignment textAlignment
  • BOOL has3DStyle
  • UIColor *borderColor
  • CGFloat cornerRadius
  • CGFloat borderWidth
  • BOOL hasShadow
  • CMPopTipAnimation animation
  • CGFloat maxWidth
  • PointDirection preferredPointDirection
  • BOOL hasGradientBackground
  • CGFloat sidePadding
  • CGFloat topMargin
  • CGFloat pointerSize
  • CGFloat bubblePaddingX
  • CGFloat bubblePaddingY
  • BOOL dismissAlongWithUserInteraction