Recently Added iOS Source Code Examples

More >
  • Installation
With CocoaPods, add this line to your Podfile.
pod 'JTNumberScrollAnimatedView', '~> 1.0'

Use JTNumberScrollAnimatedView for have a nice animation for display number. It's easy to use, easy to customize.

You can easily change some properties of the animation. Each caracter have its own column:
-durationOffset, delay between the end of the animation of each -column
d-ensity, number of characters by column for the animation
minLength, you can force the minimum count of columns
isAscending, the direction of the scroll
If you change one of this properties, you have to call setValue for update the view.

More Detail in Demo.



    A scroll animation for display number for iOS。

  • iOS custom view that let you add token view inside like NSTokenField.

pod 'ZFTokenField'



You need to implement these in your datasource class

lineHeightForTokenInField:tokenField: return desire line height.
numberOfTokenInField: return number of token that you want to display.
tokenField:viewForTokenAtIndex: return view that you want to display at specify index

tokenMarginInTokenInField: your prefered margin, default is 0
tokenField:didRemoveTokenAtIndex: get called when user deletes token at particular index.
tokenField:didReturnWithText: get called when user hits return with text.
tokenField:didTextChanged: get called when user changes text.
tokenFieldDidBeginEditing: get called when user begins edit the field.
tokenFieldShouldEndEditing: get called to ask if the field should end editing.
tokenFieldDidEndEditing: get called when user stops edit the field.



    iOS custom view that let you add token view inside like NSTokenField。

  • A password strength view that uses smiley faces to depict the strength of a password.

-Set a custom font colour for the smiley faces, so that you can style it according to your app.
-Set a custom font size

- (void)viewDidLoad {
    [super viewDidLoad];

    //Create the password strength view
    CGRect frame = CGRectMake(0, 0, CGRectGetHeight(self.passwordTextField.frame), CGRectGetHeight(self.passwordTextField.frame));
    self.smileyStrength = [[KMMSmileyStrength alloc] initWithFrame:frame];
    //Set it as the text field's right view
    self.passwordTextField.rightView = self.smileyStrength;
    self.passwordTextField.rightViewMode = UITextFieldViewModeNever;
 *  Called when the text field's editing changed
 *  @param sender the UITextField for the password
-(IBAction)textDidChange:(id)sender {
    UITextField *textfield = sender;
    if(textfield.text.length > 0) {
        [self.smileyStrength evaluatePassword:textfield.text];
        self.passwordTextField.rightViewMode = UITextFieldViewModeAlways;
    } else {
        self.passwordTextField.rightViewMode = UITextFieldViewModeNever;



    A password strength display using smiley faces。

  • The QRCodeReaderViewController is a simple QRCode Reader/Scanner based on the AVFoundation framework from Apple. It aims to replace ZXing or ZBar for iOS 7 and over.

It also allows you to switch between the front and the back cameras.

Download the project and copy the QRCodeReaderViewController folder into your project and then simply #import "QRCodeReaderViewController.h" in the file(s) you would like to use it in.

- (IBAction)scanAction:(id)sender
  QRCodeReaderViewController *reader = [QRCodeReaderViewController new];
  reader.modalPresentationStyle      = UIModalPresentationFormSheet;

  // Using delegate methods
  reader.delegate                    = self;

  // Or by using blocks
  [reader setCompletionWithBlock:^(NSString *resultAsString) {
    [self dismissViewControllerAnimated:YES completion:^{
      NSLog(@"%@", result);

  [self presentViewController:reader animated:YES completion:NULL];

#pragma mark - QRCodeReader Delegate Methods

- (void)reader:(QRCodeReaderViewController *)reader didScanResult:(NSString *)result
  [self dismissViewControllerAnimated:YES completion:^{
    NSLog(@"%@", result);

- (void)readerDidCancel:(QRCodeReaderViewController *)reader
  [self dismissViewControllerAnimated:YES completion:NULL];



    Simple QRCode reader for iOS 7 and over。

  • This layout is an alternative to UICollectionViewFlowLayout that positions and sizes items using a defined number of columns and an aspect ratio property which force the size of cells, rather than the cells' size telling the layout how to position them (in the way UICollectionViewFlowLayout behaves). By default, this will always show the same number of items in a row no matter how large or small the collection view is.

You can specify the number of items per line and the desired aspect ratio of all items (which is always width / height, regardless of scroll direction):

layout.numberOfItemsPerLine = 5;
layout.aspectRatio = 16.0/9.0;
You can specify metrics similar to UICollectionViewFlowLayout, like so:

layout.sectionInset = UIEdgeInsetsMake(10,20,30,40);
layout.interitemSpacing = 15;
layout.lineSpacing = 5;
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
As of 0.1.x, this layout supports multiple sections, but no supplementary views and no per-section grid metrics.

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

To run the example project, clone the repo, and run pod install from the Example directory first. You can either run unit tests on the library itself, or run the sample project for a visual demonstration.



    A UICollectionViewLayout that specifies item size and location by number of columns.。

  • Emulating the Imgur activity Indicator from the web.

IMGActivityIndicator *indicator = [[IMGActivityIndicator alloc] initWithFrame:CGRectMake(screenWidth/ 2 - 50, screenHeight/2 - 50, 100, 100)];
    [self.view addSubview:indicator];



    Emulating the Imgur activity Indicator from the web。

  • Install
Just drag the folder named MHHexColoring to your project and add #import "UIColor+HexString.h"

to your header

whenever you want to convert a hex color from your photoshop into UIColor .. just call

[UIColor colorWithHexString:@"#ffffff"];

Get Hex ColorCode:



    iOS Category to turn color hex string RBG to UIColor。

  • Custom alert view with gesture support and block-based API.


Wherever you want to use GUAAlertView, import the header file as follows:

#import "GUAAlertView.h"

GUAAlertView *v = [GUAAlertView alertViewWithTitle:@"title"
                                       NSLog(@"button touched");
                                   } dismissAction:^{

[v show];



    Custom alert view with gesture support and block-based API。

  • Integration

DBPrivacyHelper is a simple UIViewController category and it has a simple integration:

Import UIViewController+DBPrivacyHelper.h
Open the modal using a simple method:
- (void) openHelper {
    [self showPrivacyHelperForType:DBPrivacyTypeLocation];
Use the other method to customize the controller or the action blocks:
- (void) openHelperToCustomize {
    [self showPrivacyHelperForType:DBPrivacyTypeLocation controller:^(DBPrivateHelperController *vc) {
        //customize the view controller to present
    } didPresent:^{
        //customize the completion block of presentViewController:animated:completion:
    } didDismiss:^{
        //customize the completion block of dismissViewControllerAnimated:completion:
    } useDefaultSettingPane:YES];
If useDefaultSettingPane: is set to YES, DBPrivacyHelper opens the default setting pane in iOS 8. Set NO if you want to see the DBPrivateHelperController with all iOS.
Privacy settings types:



    Quick tool to explain the right place to enable your privacy settings。

  • MMScrollPresenter is a control for iOS development that takes an array of MMScrollPages and displays them in your UIScrollView.

I was initially insipired by a control in the Destiny App, so I'd recommend checking that out as well.

Example Usage

Download the repo and include MMScrollPresenter.h/.m, MMScrollPage.h/.m, arrow/@2x.png in your app
Drag and drop a UIScrollView into your Interface Builder and under the custom class section, subclass your UIScrollView to MMScrollPresenter
Now add: @property (weak, nonatomic) IBOutlet MMScrollPresenter *mmScrollPresenter; to your list of properties and dont forget to link it up in your Interface Builder
Add a MMScrollPage to the MMScrollPresenter
Here is a code snippet from the example app in the - (void)viewDidLoad method for #4:

UIImageView *mountainImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mountains.jpg"]];
[mountainImage setFrame:CGRectMake(0, 0, self.mmScrollPresenter.frame.size.width, self.mmScrollPresenter.frame.size.height)];

MMScrollPage *firstPage = [[MMScrollPage alloc] init];
firstPage.titleLabel.text = @"Look a picture of mountains";
firstPage.detailLabel.text = @"I'm the detail text";
[firstPage.backgroundView addSubview:mountainImage];
firstPage.titleBackgroundColor = [UIColor colorWithRed:119/255.0f green:92/255.0f blue:166/255.0f alpha:0.5];

[self.mmScrollPresenter setupViewsWithArray:@[firstPage]];



    Custom UIScrollView Control for paging UIViews。

  • A replacement for ABPeoplePickerNavigationController that supports UILocalized​Indexed​Collation. ZLPeoplePickerViewController was originally created for Talkly.


-Supports multilingual indexing and sorting by implementing UILocalized​Indexed​Collation using LRIndexedCollationWithSearch.
-Supports searching by name, emails and addresses. The results are displayed using UISearchController in iOS 8.
-Supports multiple selection.
-Supports field mask for filtering contacts.
-Support searching by phone number

More detail On gitHub or Demo.



    A replacement for ABPeoplePickerNavigationController that supports UILocalized​Indexed​Collation。

  • UIUserNotificationSettings-Extension provides helper methods that will make you much easier to handle the new #iOS8 #Interactive #Notifications.



    UIUserNotificationSettings-Extension provides helper methods that will make you much easier to handle the new #iOS8 #Interactive #Notifications.。

  • Features

-Dropdown view with blur+transform3D effect.
-Using keyframe animation from Core Animation.
-You can easily change the menu content view.


Drag the LMDropdownView folder into your project.
Add #include "LMDropdownView.h" to the top of classes that will use it.

You can easily integrate the LMDropdownView with a few lines of code. For an example usage look at the code below.

LMDropdownView *dropdownView = [[LMDropdownView alloc] init];
dropdownView.menuContentView = self.menuTableView;
[dropdownView showInView:self.view withFrame:self.view.bounds];
See sample Xcode project in LMDropdownViewDemo.



    LMDropdownView is a simple dropdown view inspired by Tappy。

  • JTImageLabel is a simple view which contain a UILabel and a UIImageView which stay side by side, even if you change the alignment of the UILabel.

With CocoaPods, add this line to your Podfile.
pod 'JTImageLabel', '~> 1.0'

It's very easy to use.

#import <UIKit/UIKit.h>
#import "JTImageLabel.h"
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet JTImageLabel *label;
You can access directly to the imageView and the textLabel. Also you can define the space between the two views.

@implementation ViewController

- (void)viewDidLoad
    [super viewDidLoad];

    self.label.imageView.image = [UIImage imageNamed:@"icon"];
    self.label.textLabel.text = @"Test";
    self.label.textLabel.textAlignment = NSTextAlignmentRight; = 10.; // Add a space between the imageView and the textLabel

You cannot change the frame of the imageView and the textLabel. The imageView has the same size as this image and the textLabel adapts to its relative content.



    JTImageLabel keeps a UILabel and a UIImageView side by side。

  • Custom UICollectionViewLayout that works together with a custom UICollectionViewCell to provide drag and drop for a UICollectionView. Works just like UITableView drag and drop. What's unique about this approach is that it does not need to create a "ghost" or "dummy" cell to provide the drag and drop functionality. I believe this method is simpler and less complex for the majority of use cases.

Adding to your project:

CocoaPods is the recommended way to add HTKDragAndDropCollectionViewLayout to your project.

Add a pod entry for HTKDragAndDropCollectionViewLayout to your Podfile pod 'HTKDragAndDropCollectionViewLayout', '~> 0.0.1'
Install the pod(s) by running pod install.
Subclass HTKDragAndDropCollectionViewController.
Setup HTKDragAndDropCollectionViewLayout properties (itemSize, lineSpacing, etc).
Subclass and use HTKDraggableCollectionViewCell which implements the gestures for dragging.
Implement - (void)userDidEndDraggingCell:(UICollectionViewCell *)cell and if the HTKDragAndDropCollectionViewLayout finalIndexPath is not nil, insert the draggedIndexPath into the finalIndexPath's position. See example in project.



    UICollectionViewLayout subclass that works together with a custom UICollectionViewCell to provide drag and drop for a UICollectionView。

  • UIImageView subclass that loads the image progressively.

#import "MDIncrementalImageView.h"

MDIncrementalImageView *imageView = [[MDIncrementalImageView alloc] initWithFrame:CGRectMake(25, 5, 100, 100)];
[imageView setImageUrl:[NSURL URLWithString:[dataSource objectAtIndex:indexPath.row]]];

More detail in demo.



    UIImageView subclass that loads the image progressively。

  • CountryPicker is a custom UIPickerView subclass that provides an iOS control allowing a user to select a country from a list. It can optionally display a flag next to each country name, and the library includes a set of 249 public domain flag images from that have been renamed to work with the library.

Note that the list of countries is based on the ISO 3166 country code standard ( This list excludes certain smaller countries, regarding them as part of a larger state. For example, England, Scotland, Wales and Northern Ireland are lumped together as Great Britain. For most purposes this is fine as it matches the convention used for locales, but if you need to specify additional countries, you can subclass and modify the countires list as described under "Subclassing" below.



    CountryPicker is a custom UIPickerView subclass that provides an iOS control allowing a user to select a country from a list。

  • Complete iOS camera engine with Vine like pause/resume, filters, ghost mode, player with smooth loop, exporter with precise parameters

A Vine/Instagram like audio/video recorder and filter framework in Objective-C.

In short, here is a short list of the cool things you can do:

Record multiple video segments
Remove any record segment that you don't want
Display the result into a convenient video player
Save the record session for later somewhere using a serializable NSDictionary (works in NSUserDefaults)
Add a video filter using Core Image
Merge and export the video using fine tunings that you choose
Examples for iOS are provided.

Framework needed:


More Detail in Demo or See the usage in Github.



    A Vine/Instagram like audio/video recorder and filter framework in Objective-C。

Popular Code

More >
  • 实现效果不错的可展开cell的列表(TableView)。列表cell最左边的accessory 在cell展开的时候会发生变化。



    An expandable table view。

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

    Multi Layer Navigation


    Drag to go back Interaction Implementaion。

  • 实现微信选取图片并裁剪成头像的控件。



    Crop an image to round shape for use as an user avatar。

  • 使用最新的AFNetworking库和AFDownloadRequestOperation实现了断点续传下载。
小编注:感谢开发者@MeSterBan 分享代码于Code4App。



    Use AFNetworking and AFDownloadRequestOperation to implement resuming download。

  • 实现类似QQ的聊天功能界面,利用气泡(bubble)视图显示对话消息,可以同时输入文字和表情。

    Styled Chat


    The StyledChatDemo is a chat bubble demonstration project inspired by the open source Adium.The demo adapted the Adium's Renkoo message style,supported dynamically changing the style variant。

  • 将来自互联网的图片或者本地相册的照片按照时间顺序放在列表中显示。

    Photo Collection Controller


    REPhotoCollectionController is a photo thumbnail viewer for the iOS that groups photos by date。

  • 基于 cocos2d-x 编写的对对碰游戏。即三个相同图案排成一行的时候就会消去。
小编注:感谢开发者@埃博拉病毒 分享代码于Code4App。

    Puzzle game by cocos2d-x


    Puzzle game made by cocos2d-x。