Recently Added iOS Source Code Examples

More >
  • Usage

Create a instance of any UIView subclass.
Call the show(modalView: , inView: ) of PathDynamicModal class-function or instance-function.
For detail, please refer to Demo-project.

class func show(modalView view: UIView, inView: UIView) -> PathDynamicModal // Show modal with settings default all.
func show(modalView view: UIView, inView: UIView) // Show modal with custom settings.
func closeWithLeansRandom() // Close modal with random slant.
func closeWithStraight() // Close modal with non slant.
func closeWithLeansRight() // Close modal with right slant.
func closeWithLeansLeft() Close modal with left slant.

var backgroundColor: UIColor // Default is UIColor.blackColor()
var backgroundAlpha: CGFloat // Default is 0.7 
var showMagnitude: CGFloat // Default is 250.0. This affects the speed of modal dropping to show.
var closeMagnitude: CGFloat // Default is 170.0. This affects the speed of modal dropping to close.
var closeByTapBackground: Bool // Default is true
var closeBySwipeBackground: Bool // Default is true
var showedHandler: (() -> Void)?
var closedHandler: (() -> Void)?

More detail please refer the demo.



    A modal view using UIDynamicAnimator, like the Path for iOS。

  • A nice and simple tags input control for iOS.

You are able to easily setup different colors for control elements and set different displaying modes

Switching between displaying modes

You are able to switch between displyaing modes by setting the mode property

@property (nonatomic) TLTagsControlMode mode;
TLTagsControl has two displaying modes:

This mode allows user to input new tags and delete tags that are already presented.

In this mode control will look like below:


This mode allows only listing of already presented tags

In this mode control will look like below:


Setting different colors of control elements

You are able to change colors of different element by setting these prperties

@property (nonatomic, strong) UIColor *tagsBackgroungColor;
@property (nonatomic, strong) UIColor *tagsTextColor;
@property (nonatomic, strong) UIColor *tagsDeleteButtonColor;
Applying changes

To apply your changes you should call the method below

- (void)reloadTagSubviews;

//assuming tagControl will be set initialized from stroryboard
@interface ViewController ()

@property (nonatomic, strong) IBOutlet TLTagsControl *tagControl;



@implementation ViewController

- (void)viewDidLoad {
  [super viewDidLoad];

  UIColor *blueBackgroundColor = [UIColor colorWithRed:75.0/255.0 green:186.0/255.0 blue:251.0/255.0 alpha:1];
  UIColor *whiteTextColor = [UIColor whiteColor];

  self.tagControl.tagsBackgroungColor = blueBackgroundColor;
  self.tagControl.tagsDeleteButtonColor = whiteTextColor;
  self.tagControl.tagsTextColor = whiteTextColor;

  self.tagControl.mode = TLTagsControlModeList;

  [self.tagControl reloadTagSubviews];




    A nice and simple tags input control for iOS。

  • A simple control for implementing a beautiful scrolling segment control. With adaptive gradient to tease the user to explore all the items in the list. Fully customizable either by code or using interface builder.



    Beautiful and easy to use scrolling segment control.。

  • KDCircularProgress is a circular progress view written in Swift. It makes it possible to have gradients in the progress view, along with glows and animations.



    A circular progress view with gradients written in Swift。

  • Most simple usage:

// Get four dominant colors from the image, but avoid the background color of our UI
CCColorCube *colorCube = [[CCColorCube alloc] init];
UIImage *img = [UIImage imageNamed:@"test2.jpg"];
NSArray *imgColors = [colorCube extractColorsFromImage:img avoidColor:myBackgroundColor co



    Dominant color extraction from RGB images on iOS。

  • SwiftNotice is a GUI library for displaying various popups written in pure Swift, fits any scrollview.



    GUI library for displaying various popups, written in pure Swift.。

Checkout PPDragDropBadgeView from github.
Copy PPDragDropBadgeView folder to your project.
Go to 'TARGET' -> 'Build Phases' -> 'Complile Sources', add compliler flags '-fno-objc-arc' for 'PRTween.m' and 'PRTweenTimingFunctions.m'
You can also refer to the example project provided by me.


Q: How to use PPDragDropBadgeView?
A: Very simple, you only follow the down code.

PPDragDropBadgeView* badgeView \
= [[PPDragDropBadgeView alloc] initWithSuperView:self.testView
                                      radius:10.0f dragdropCompletion:^{
                                                     NSLog(@"Drag drop done.");
badgeView.text = @"6";
Q: Does it can be customized?

A: Of course, you can set "location", "radius", "tintColor", "borderWidth", "borderColor". You can see the propertys provided by me.

/** The location of badge view. */
@property (nonatomic, assign) CGPoint location;

/** The radius of badge view. */
@property (nonatomic, assign) CGFloat radius;

/** The completion block when drag drop done. */
@property (nonatomic, copy) void(^dragdropCompletion)();

/** The tint color of badge view. Default is red */
@property (nonatomic, strong) UIColor* tintColor;

/** The border color of badge view. Default is clear */
@property (nonatomic, strong) UIColor* borderColor;

/** The border width of badge view. Default is 1.0f */
@property (nonatomic, assign) CGFloat borderWidth;

/** The text of badge view. */
@property (nonatomic, strong) NSString* text;



    PPDragDropBadgeView is a badge view which able to drag and drop. Just like QQ 5.0 badge view.。

  • Usage

Instantiate and set delegate and dataSource as you know,

self.pickerView = AKPickerView(frame: <#frame#>)
self.pickerView.delegate = self
self.pickerView.dataSource = self
then specify the number of items using AKPickerViewDataSource,

func numberOfItemsInPickerView(pickerView: AKPickerView) -> Int {}
and contents to be shown. You can use either texts or images:

func pickerView(pickerView: AKPickerView, titleForItem item: Int) -> NSString {}
// OR
func pickerView(pickerView: AKPickerView, imageForItem item: Int) -> UIImage {}
Using both texts and images are currently not supported. When you implement both, titleForItem will be called and the other won't.
You currently cannot specify image sizes; AKPickerView shows the original image in its original size. Resize your images in advance if you need.
You can change its appearance with properties below:

var font: UIFont
var highlightedFont: UIFont
var textColor: UIColor
var highlightedTextColor: UIColor
var interitemSpacing: CGFloat
var viewDepth: CGFloat
var pickerViewStyle: AKPickerViewStyle
All cells are laid out depending on the largest font, so large differnce between the sizes of font and highlightedFont is NOT recommended.
viewDepth property affects the perspective distortion. A value near the screen's height or width is recommended.
After all settings, never forget to reload your picker.

Optional: You can use AKPickerViewDelegate methods to observe selection changes:

func pickerView(pickerView: AKPickerView, didSelectItem item: Int) {}


In your Podfile:
pod "AKPickerView-Swift"

And in your *.swift:
import AKPickerView_Swift



    A simple yet customizable horizontal picker view。

  • Usage:
self.indicatorView1 = MAActivityIndicatorView(frame: self.viewForActivity1.frame)
            self.indicatorView1.defaultColor = UIColor.redColor()
            self.indicatorView1.animationDuration    = 1
            self.indicatorView1.numberOfCircles      = 15
            self.indicatorView1.maxRadius            = 40
            self.indicatorView1.delegate = self
           // self.indicatorView1.backgroundColor = UIColor.lightGrayColor()



    a custom activity indicator with little dots written in Swift。

  • Custom Calendar for iOS Grid Calendar view for iOS created by Jubin Jacob ( Swipe to change months.

Delegate displays selected date(NSDate) on selection of a date.

Datasource allows some days to be highlighted and the calendar to be « locked » between a starting month and an ending month.



    Custom Calendar for iOS。

  • JDFPeekaboo is a simple class that hides the navigation bar when you scroll down, and shows it again when you scroll back up. It can actually be any UIView that it hides, and it will also hide a view at the bottom of the screen as well, if you like.

It's very easy to use. Simply add a property for it:

@property (nonatomic, strong) JDFPeekabooCoordinator *scrollCoordinator;
Then, set it up (say, in -viewDidLoad):

self.scrollCoordinator = [[JDFPeekabooCoordinator alloc] init];
self.scrollCoordinator.scrollView = self.scrollView;
self.scrollCoordinator.topView = self.navigationController.navigationBar;
self.scrollCoordinator.bottomView = self.navigationController.toolbar;
Sometimes, you may want to temporarily disable JDFPeekaboo, for example when you push another view controller onto your navigation controller. Some convenience methods are provided for disabling JDFPeekaboo (and re-enabling it).



    JDFPeekaboo is a simple class that hides the navigation bar when you scroll。

  • Recreate Twitter's profile page scrolling animation for UITableView and UIScrollViews. Librarys uses Core graphics framework and is based of's swift tutorial converted into Obj-C.


From CocoaPods
MBTwitterScroll is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "MBTwitterScroll"

Copy the source files MBTwitterScroll folder into your project.

#import "MBTwitterScroll.h"


To show animation on UITableVIew use the following code:

    MBTwitterScroll *myTableView = [[MBTwitterScroll alloc]
                                    initTableViewWithBackgound:[UIImage imageNamed:@"your image"]
                                    avatarImage:[UIImage imageNamed:@"your avatar"]
                                    titleString:@"Main title"
                                    subtitleString:@"Sub title"
                                    buttonTitle:@"Follow"];  // Set nil for no button
    myTableView.delegate = self;
    [self.view addSubview:myTableView];


To show animation on UIScrollView use the following code:

   MBTwitterScroll *myScrollView = [[MBTwitterScroll alloc]
                                      avatarImage:[UIImage imageNamed:@"avatar.png"]
                                      titleString:@"Main title"
                                      subtitleString:@"Sub title"
                                      buttonTitle:@"Follow" // // Set nil for no button
    myScrollView.delegate = self;
    [self.view addSubview:myScrollView];



    Recreate Twitter's profile page scrolling animation for UITableView and UIScrollViews。

  • Installation

The easiest way to get started is to use CocoaPods. Add the following line to your Podfile:
platform :ios, '8.0'
# The following is a Library of Swift.
pod 'MediumMenu'
Then, run the following command:

pod install
Or add the MediumMenu (including MediumMenu.swift) folder into your project.

Due to the lack of choice whether status bar is hidden or not, Edit info.plist in your project.

Add "Status bar is initially hidden" and "View controller-based status bar appearance" in info.plist as key. Eash value is "YES" and "NO".

In the rest of the details, refer to MediumMenu-Sample project.



    A menu based on Medium iOS app。

  • You can use secret command with swipe gesture and A, B button. Show a secret mode you want!
-Secret command register
-Unlock with secret command
- Show input command with animation


SASecretCommandViewController is available through CocoaPods. If you have cocoapods 0.36 beta or greater, you can install it, simply add the following line to your Podfile:
pod "SASecretCommandViewController"

Add the SASecretCommandViewController directory to your project.

See the example project for the detail usage.




  • HoleView, holes methods

- (NSInteger)addHoleCircleCenteredOnPosition:(CGPoint)centerPoint andDiameter:(CGFloat)diamter;
- (NSInteger)addHoleRectOnRect:(CGRect)rect;
- (NSInteger)addHoleRoundedRectOnRect:(CGRect)rect withCornerRadius:(CGFloat)cornerRadius;
- (NSInteger)addHCustomView:(UIView *)customView onRect:(CGRect)rect;

HoleView Delegation : JMHoledViewDelegate

This method will be called if you configure a holeViewDelegate. The index is equal to NSNotFound if user touch dimingView.

- (void)holedView:(JMHoledView *)holedView didSelectHoleAtIndex:(NSUInteger)index;



    A view design to be filled with holes。

  • Usage

Import category #import <UIViewController-KeyboardAdditions/UIViewController+KeyboardAdditions.h>

Register to keyboard notifications in -viewWillAppear::

[self ka_startObservingKeyboardNotifications];
Unregister from notifications in -viewWillDisappear::
[self ka_stopObservingKeyboardNotifications];
Perform any layout with same animation options as keybord:
- (void)ka_keyboardShowOrHideAnimationWithHeight:(CGFloat)height
                                  animationCurve:(UIViewAnimationCurve)animationCurve {

    self.containerViewBottomConstraint.constant = height;
    [self.view layoutIfNeeded];



    Tiny UIViewController category that provides handy way for keyboard handling logic。

  • ABCIntroView is an easy to use onboarding which allows you to introduce your users to the applicaiton before reaching the Main Screen.

To use the ABCIntroView please do the following:

Add the follwing files found in the CLASSES folder to your project:
Import the ABCIntoView file to your RootViewController.

Create an ABCIntroView property and add the ABCIntroViewDelegate.

Add the following line of code to your ViewDidLoad:

    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    if (![defaults objectForKey:@"intro_screen_viewed"]) {
        self.introView = [[ABCIntroView alloc] initWithFrame:self.view.frame];
        self.introView.delegate = self;
        self.introView.backgroundColor = [UIColor greenColor];
        [self.view addSubview:self.introView];  
Add the ABCIntroView Delegate Method:
#pragma mark - ABCIntroViewDelegate Methods

    //    Uncomment so that the IntroView does not show after the user clicks "DONE"
    //    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]
    //    [defaults setObject:@"YES"forKey:@"intro_screen_viewed"];
    //    [defaults synchronize];
    [UIView animateWithDuration:1.0 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
        self.introView.alpha = 0;
    } completion:^(BOOL finished) {
        [self.introView removeFromSuperview];



    an easy to use onboarding which allows you to introduce your users to the applicaiton before reaching the Main Screen。

  • Usage:
set the mark through a plist file&#40;refer the demo's plist&#41;

 NSDictionary* coachMarkDict =
     dictionaryWithContentsOfFile:[[NSBundle mainBundle]
    PIImageCoachmark* coachmark1 = [[PIImageCoachmark alloc] initWithDictionary:coachMarkDict];

    PICoachmarkScreen* screen1 = [[PICoachmarkScreen alloc] initWithCoachMarks:@[coachmark1]];

    [window addSubview:coachMarksView];
    [coachMarksView setScreens:@[screen2, screen1]];
    [coachMarksView start];

See the example project for the Usage.



    A extensible and easy coach mark libary。

Popular Code

More >
  • 类似于Faceboo App的Stacked View。点击主界面上的一个按钮时,主界面左边滑动一半显示出一个子视图,点击列表上任意一行,右边部分出现新内容,左边子视图滑出界面。当对左边视图进行搜索时,左边一半界面的视图变成全界面显示搜索内容。

    SideBar Navigation


    A clone of the new Facebook iOS UI paradigm。

  • 实现网易新闻app/新浪微博app中手指右滑屏幕返回上一层视图的交互。利用UINavigationControler组织多层,即也可以用导航栏(UINavigationBar)的返回按钮返回上一层。支持视图上有scrollview等页面。
小编注:这份代码比较好地模仿了网易新闻/新浪微博app右滑屏幕返回的交互效果,推荐!感谢作者@Feather-Mie 分享原创代码于Code4App。

    Multi Layer Navigation


    Drag to go back Interaction Implementaion。

  • 获取系统emoji表情,实现表情键盘,输入框能够随着输入文字的长度而自动增长,模仿微信键盘,能够切换文字键盘和表情键盘。
小编注:感谢作者@好好happy好好 分享原创代码于Code4App。

    custom emoji keyboard


    custom emoji keyboard。

  • 实现转盘菜单效果。转盘菜单用在建设银行的app中,点击转盘菜单上某个按钮,则菜单进行转动,被点击的按钮会慢慢被转到最前面。由于转动的过程中,按钮会有大变小或者由小变大,所以这个动画有3D的效果。

    Dial Menu


    A dial menu demo. Can scroll the screen to select different menu item。

  • 自定义相机拍摄界面,仿照Instagram。
小编注:感谢开发者@Aevit 发布代码于。



    A Custom Camera with AVCaptureSession to take a square picture. And the UI is patterned on Instagram。

  • 实现效果多样的HUD。这是小编看过的效果最多样化的HUD。可以设置很多关于HUD动画和外观的参数。包括,可以设置HUD是否有边框(border),设置HUD出现和消失的方式(包括上下、左右、淡入淡出、放大缩小等等),设置HUD的内容(可以在HUD中加入帧动画、动态图片等等),设置HUD出现时的底部覆盖层颜色,等等。总而言之,这是一份集大成的HUD代码。慢慢看视频吧,囊括了所有效果。
小编注:不过,可惜的是这么多效果,却没有扁平化风格(Flat UI)的效果。



    An easy-to-use HUD interface with personality。

  • 很方便自定义各种 Tab Bar 外观,也可以用作 Tool Bar。



    Easy applicable toolbar/tabbar component for iOS。