• Stars
    star
    2,734
  • Rank 16,652 (Top 0.4 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 14 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Custom UIView for iOS that pops up an animated "bubble" pointing at a button or other view. Useful for popup tips.

CMPopTipView

Build Status

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.

The source includes a universal (iPhone/iPad) demo app.

一个泡泡风格的提示框开源控件, 继承自UIView。iPad,iPhone通用

URLs

Used in apps:

Screenshots

Videos

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

Usage

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

// Present a CMPopTipView pointing at a UIBarButtonItem in the nav bar
CMPopTipView *navBarLeftButtonPopTipView = [[CMPopTipView alloc] initWithMessage:@"A Message"];
navBarLeftButtonPopTipView.delegate = self;
[navBarLeftButtonPopTipView presentPointingAtBarButtonItem:self.navigationItem.leftBarButtonItem animated:YES];

// Dismiss a CMPopTipView
[navBarLeftButtonPopTipView dismissAnimated:YES];

// CMPopTipViewDelegate method
- (void)popTipViewWasDismissedByUser:(CMPopTipView *)popTipView {
    // any code
}

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

- (IBAction)buttonAction:(id)sender {
    // Toggle popTipView when a standard UIButton is pressed
    if (nil == self.roundRectButtonPopTipView) {
        self.roundRectButtonPopTipView = [[CMPopTipView alloc] initWithMessage:@"My message"];
        self.roundRectButtonPopTipView.delegate = self;
        self.roundRectButtonPopTipView.backgroundColor = [UIColor lightGrayColor];
        self.roundRectButtonPopTipView.textColor = [UIColor darkTextColor];

        UIButton *button = (UIButton *)sender;
        [self.roundRectButtonPopTipView presentPointingAtView:button inView:self.view animated:YES];
    }
    else {
        // Dismiss
        [self.roundRectButtonPopTipView dismissAnimated:YES];
        self.roundRectButtonPopTipView = nil;
    }
}

#pragma mark CMPopTipViewDelegate methods
- (void)popTipViewWasDismissedByUser:(CMPopTipView *)popTipView {
    // User can tap CMPopTipView to dismiss it
    self.roundRectButtonPopTipView = nil;
}

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
  • BOOL showFromCenter
  • CGFloat sidePadding
  • CGFloat topMargin
  • CGFloat pointerSize
  • CGFloat bubblePaddingX
  • CGFloat bubblePaddingY
  • BOOL dismissAlongWithUserInteraction

ARC

The CMPopTipView Master branch uses ARC as of version 2.0.

If you want a non-ARC version you should look at tag 1.3.0.

Support

CMPopTipView is provided open source with no warranty and no guarantee of support. However, best effort is made to address issues raised on Github https://github.com/chrismiles/CMPopTipView/issues .

If you would like assistance with integrating CMPopTipView or modifying it for your needs, contact the author Chris Miles [email protected] for consulting opportunities.

License

CMPopTipView is Copyright (c) 2010-2015 Chris Miles and released open source under a MIT license:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

More Repositories

1

CMUnistrokeGestureRecognizer

A port of the $1 Unistroke Recognizer (aka Dollar Gesture Recognizer) to iOS as a UIGestureRecognizer.
Objective-C
650
star
2

DynamicXray

iOS UIKit Dynamics runtime visualisation and introspection library.
Objective-C
561
star
3

EZForm

iOS form handling and validation library.
Objective-C
285
star
4

CMTraerPhysics

Objective-C/Cocoa port of the Traer v3.0 physics engine; with iOS demo app.
Objective-C
121
star
5

CMTextStylePicker

iOS view controller tree for presenting a text font/size/colour picker to user.
Objective-C
98
star
6

FancySegue

Fancy storyboard segue transitions rendered with OpenGL ES. Originally presented during the OpenGL ES for iOS 5 talk by Chris Miles at Swipe Conference 2012.
Objective-C
60
star
7

OrganisingCoreData

Organising Core Data Demo iPhone App
Objective-C
37
star
8

ProximityLight

Automagical LIFX bulb control from Estimote iBeacon proximity events.
Objective-C
19
star
9

SwipeOpenGLTriangles

Demo app from the OpenGL ES for iOS 5 talk by Chris Miles at Swipe Conference 2012.
Objective-C
11
star
10

Swipe3D

Demo app from the OpenGL ES for iOS 5 talk by Chris Miles at Swipe Conference 2012.
C
10
star
11

SliceTool

OS X command-line tool to slice up images at multiple resolutions for use in a CATiledLayer.
Objective-C
9
star
12

AHEasing

A library of easing functions for C, C++ and Objective-C
Objective-C
5
star
13

GLPixelAccuratePerspective

Objective-C
4
star
14

MacSceneKitTemplate

Simplest Mac SceneKit application - to use as a template
Objective-C
2
star
15

DIYMeteorology

DIY Meteorology Weather Station
Arduino
1
star
16

Arduino-Footprints

IDL
1
star
17

CMBluetoothKit

Objective-C
1
star