Recently Added iOS Source Code Examples

More >
  • Features:
-Easy to use - setup a basic radial menu in just a few lines of code.
-Works out of the box or customize to your heart's content.
-Full featured delegate protocol to react to or interrupt interactions.
-Interactive development mode - adjust menu inside your own app in real time

Simply drag CKRadialMenu.h and CKRadialMenu.m into your project.
Cocoa pod support coming soon.

Refer the detail in the Demo.



    An iOS framework for customizable radial popout menus。

  • Modeled after iOS7 style segmented controls, simple, practical!

float init_y = 0;
    for (int i=0; i<10; i++) {
        RFSegmentView* segmentView = [[RFSegmentView alloc] initWithFrame:CGRectMake(0, 10+init_y, kScreenWidth, 60) items:@[@"spring",@"summer",@"autumn",@"winnter"]];
        segmentView.tintColor = [self getRandomColor];
        segmentView.delegate = self;
        [self.view addSubview:segmentView];
        init_y +=60;

- (void)segmentViewSelectIndex:(NSInteger)index
    NSLog(@"current index is %d",index);



    Modeled after iOS7 style segmented controls, simple, practical!。

  • A hardware-accelerated audio visualization view using EZAudio, inspired by AudioCopy. ZLHistogramAudioPlot was originally developed for Murmur.

You can install ZLHistogramAudioPlot through CocoaPods adding the following to your Podfile:
pod 'ZLHistogramAudioPlot'

Customizable attributes:
/// The upper bound of the frequency range the audio plot will display. Default:
/// 10000Hz
@property (nonatomic) float maxFrequency;

/// The lower bound of the frequency range the audio plot will display. Default:
/// 1200Hz
@property (nonatomic) float minFrequency;

/// The number of bins in the audio plot. Default: 30
@property (nonatomic) NSUInteger numOfBins;

/// The padding of each bin in percent width. Default: 0.1
@property (nonatomic) CGFloat padding;

/// The gain applied to the height of each bin. Default: 10
@property (nonatomic) CGFloat gain;

/// A float that specifies the vertical gravitational acceleration applied to
/// each bin. Default: 10 pixel/sec^2
@property (nonatomic) float gravity;

/// The color of all bins in the audio plot.
@property (strong, nonatomic) UIColor *color;

/// An array of color objects defining the color of each bin in the audio plot.
/// If not set, the color attribute will be used instead. Currently only
/// supported by plot type EZPlotTypeBuffer.
@property (strong, nonatomic) NSArray *colors;

ZLHistogramAudioPlot is a subclass of EZAudioPlot. It requires EZAudio.
It also requires Accelerate framework for hardware acceleration.

ZLHistogramAudioPlot uses the following interface provided by EZAudio to get audio data:
- (void)updateBuffer:(float *)buffer withBufferSize:(UInt32)bufferSize;
It can be easily modified to work with Audio Unit and Core Audio.

Checkout the demo app for an example.



    A hardware-accelerated audio visualization view using EZAudio, inspired by AudioCopy.。

  • Benefits of using the Font:
-Import is easier to project(Since held together in one file)
-Color easy to change
-Resistant to change size
-Management easier
-Put out in the text as part of the AttributedString

Add the GoogleIcon.swift, googleicon.ttf file to your project.
info.plist added Fonts provided by application key and
specify the googleicon.ttf to Item0 value.

Please look at the icon/googleicon.html.
googleicon.html has been icon code definition.
The constant of icon code is defined in GoogleIcon class, please use.


hogeLabel.font = UIFont(name: GoogleIconName, size: 30.0)
hogeLabel.textColor = UIColor.greenColor()
hogeLabel.text = GoogleIcon.e600

You can also be set font in the storyboard. 
Refer the detail in the Demo.



    Google Material Design Icons Font for iOS。

  • Swift based UITextField subclass with floating labels.
Copy VMFloatLabelTextField.swift and VMFloatLabelTextView.swift to your project.
Drag a UITextView or UITextField,then  change the class to VMFloatLabelTextView or VMFloatLabelTextField.

Refer the detail in Demo.



    Swift based UITextField subclass with floating labels。

  • A simple view controller for navigating web pages using WKWebView.
-A browser-like view controller to support web pages navigation in your Swift app.
-Supports back-forward navigation and page refresh action.
-Supports back-forward swipe gestures.
-Has built-in activity indicators (both progress view and activity indicator).

Just grab two files GDWebViewController.swift and GDWebViewNavigationToolbar.swift into your project.
You can download GDWebBrowserClient project as well to see how it can be used.

More detail in demo or gitHub.



    WKWebview browser view controller in Swift。

  • To use this control with interface builder you just need to drop RGCircularSlider in for the class of the view in the storyboard of .xib file. You can also use initWithFrame: . To get the value of degree and the state of the button(play or pause) you need to implement the RGCircularSliderDelegate Protocol .


0 ≤ degree ≤ 360 and state is YES when you see the "play button" and NO when you see the "pause button".

Note: to make this control look good the width and heigh of the view should be equal since we want a circle.



    A simple circular slider with a play button.。

  • Present Image Picker like Instagram

With CocoaPods, add this line to your Podfile.
pod 'TWPhotoPicker', '~> 1.0.0'

    TWPhotoPickerController *photoPicker = [[TWPhotoPickerController alloc] init];
    photoPicker.cropBlock = ^(UIImage *image) {
        //do something
    [self presentViewController:photoPicker animated:YES completion:NULL];



    Present Image Picker like Instagram。

  • Image Requirements for configuring the tab bar items
-Icon image
-Selected and unselected background image
1.Uses autolayout
2.You can set custom background images, icons and text( custom font and colour) for selected, unselected states of the tabs.
3.There are two configurations for the arrangement of text and icon image (Text to the right of icon image and text to the bottom of icon image)
4.You can assign controllers for each of the tabs.
5.NMBottomTabBarController will take care of the switching and displaying of the controller views when user switches the tabs.
6.In addition the tabs can be switched programatically as required.



    A customisable tab bar controller for iOS written in Objective C。

  • The Ultimate Parental Gate to help block children from accessing in app purchase. Combines both math and dexterity skills to be very challenging.


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

Add a pod entry for HTKUltimateParentalGate to your Podfile pod 'HTKUltimateParentalGate', '~> 0.0.4'
Install the pod(s) by running pod install.
Import HTKParentalGateViewController.h where you will use it.
Register for the HTKParentalGateValidationStateChangedNotification notification in the class you want to receive state changes to. You'll receive notifications such as when the user failed or passed successfully.
The notification returns the HTKParentalGateValidationState value in the userInfo dictionary in the HTKParentalGateValidationStateChangedKey key, which is the validation state of the gate.
The gate automatically dismisses on failed/success attempts and displays and alertView on failed attempt to the user. You can customize the messages in the constants file. At a minimum you just need to present the next view on success.
If you would like to add/modify the questions, they are located in the HTKParentalGateQuestions.plist.



    The Ultimate Parental Gate to help block children from accessing in app purchase。

  • Usage:
Setup your collection view to use RAReorderableLayout.
You must reorder cells information array in RAReorderableLayoutDelegate protocol to support reordering capability.
Specifically, please refer to Demo-project.


-optional func collectionView(collectionView: UICollectionView, atIndexPath: NSIndexPath, willMoveToIndexPath toIndexPath: NSIndexPath)
-optional func collectionView(collectionView: UICollectionView, atIndexPath: NSIndexPath, didMoveToIndexPath toIndexPath: NSIndexPath)

-optional func collectionView(collectionView: UICollectionView, allowMoveAtIndexPath indexPath: NSIndexPath) -> Bool
-optional func collectionView(collectionView: UICollectionView, atIndexPath: NSIndexPath, canMoveToIndexPath: NSIndexPath) -> Bool

-optional func collectionView(collectionView: UICollectionView, collectionViewLayout layout: RAReorderableLayout, willBeginDraggingItemAtIndexPath indexPath: NSIndexPath)
-optional func collectionView(collectionView: UICollectionView, collectionViewLayout layout: RAReorderableLayout, didBeginDraggingItemAtIndexPath indexPath: NSIndexPath)
-optional func collectionView(collectionView: UICollectionView, collectionViewLayout layout: RAReorderableLayout, willEndDraggingItemToIndexPath indexPath: NSIndexPath)
-optional func collectionView(collectionView: UICollectionView, collectionViewLayout layout: RAReorderableLayout, didEndDraggingItemToIndexPath indexPath: NSIndexPath)

-optional func collectionView(collectionView: UICollectionView, reorderingItemAlphaInSection section: Int) -> CGFloat
-optional func scrollTrigerEdgeInsetsInCollectionView(collectionView: UICollectionView) -> UIEdgeInsets
-optional func scrollTrigerPaddingInCollectionView(collectionView: UICollectionView) -> UIEdgeInsets
-optional func scrollSpeedValueInCollectionView(collectionView: UICollectionView) -> CGFloat

var trigerInsets: UIEdgeInsets = UIEdgeInsetsMake(100.0, 100.0, 100.0, 100.0)
var trigerPadding: UIEdgeInsets = UIEdgeInsetsZero
var scrollSpeedValue: CGFloat = 10.0

Refer the detail in Demo.



    A UICollectionView layout whitch can move item with drag and drop.。

  • A UILabel library that automatically drops shadow if it's backgroundColor or superview's background (if your label backgroundColor is clearColor) get's brighter.

If you are making an app which contain a gallery of colorful pictures with overlay UILabel on top all of it, this will be helpful to you.

#import "Shade.h"

Shade *shadeLabel = [[Shade alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
[self.view addSubview:shadeLabel];
shadeLabel.text = @"Shade";

// Override default shadow layer
[shadeLabel setShadeColor:[UIColor blackColor]];
[shadeLabel setShadeOffset:CGSizeZero];
[shadeLabel setShadeOpacity:0.3f];
[shadeLabel setShadeRadius:10];

// Call this in viewDidAppear or any events update or method
[shadeLabel update];



    A UILabel library that automatically drops shadow if it's backgroundColor or superview's background get's brighter.。

  • Usage:
Add the SlideMenuController.swift file to your project.

In your appDelegate:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

    // create viewController code...

    let slideMenuController = SlideMenuController(mainViewController: mainViewController, leftMenuViewController: leftViewController, rightMenuViewController: rightViewController)
    self.window?.rootViewController = slideMenuController

    return true

Refer more Detail in Demo.



    iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift。

  • Swift subclass of the UISwitch which paints over the parent view with the onTintColor when the switch is turned on. Implemented concept from this Dribbble shot by Ramotion.

RAMPaperSwitch is a drop-in replacement of UISwitch. You just need to set the onTintColor property of the switch, and it will automatically paint over its superview with the selected color. You have ability to set duration of animation instead of default value.
1.Create a new UISwitch in your storyboard or nib.
2.Set the class of the UISwitch to RAMPaperSwitch in your Storyboard or nib.
3.Set onTintColor for the switch
4.Set duration property programmatically if You want to change animation duration.
5.Add animation for other views near the switch if need.

Animate views
You can animate other views near the switch. For example, you can change color to views or labels that are inside the same superview. Duration of animation can be gotten from the RAMPaperSwitch's property duration. You can animate CoreAnimation properties like this:
self.paperSwitch.animationDidStartClosure = {(onAnimation: Bool) in
    UIView.transitionWithView(self.label, duration: self.paperSwitch.duration, options: UIViewAnimationOptions.TransitionCrossDissolve, animations: {
        self.label.textColor = onAnimation ? UIColor.whiteColor() : UIColor.blueColor()
    }, completion:nil)



    RAMPaperSwitch is a Swift module which paints over the parent view when the switch is turned on.。

  • FloatLabelFields
Label Fields
Text placeholder



    Text entry controls which contain a built-in title/label so that you don't have to add a separate title for each field。

  • Installation

Drag the GMDCircleLoader/GMDCircleLoader folder into your project.
Add the QuartzCore framework to your project.
Update the definitions on your Header file if necessary.
#import “GMDCircleLoader.h” on your implementation file or add it to your projects prefix file.

(see sample Xcode project)

Use GMDCircleLoader wisely! Bad use case examples: pull to refresh, infinite scrolling, sending message.

Using GMDCircleLoader in your app will usually look as simple as this:

- (void)loginTwitter:(id)sender {
[GMDCircleLoader setOnView:self.view withTitle:@"Loading..." animated:YES];
[[Twitter sharedInstance] loginWithCompletion:^(TWTRSession *session, NSError *error) {
    if (session) {
        [GMDCircleLoading hideHUDFromView:self.view animated:YES];
Showing the loading view

You can show the status of indeterminate tasks using one of the following:

+ (GMDCircleLoader *)setOnView:(UIView *)view withTitle:(NSString *)title animated:(BOOL)animated;
Dismissing the loading view

It can be dismissed right away using:

+ (BOOL)hideFromView:(UIView *)view animated:(BOOL)animated;
Alternate views

You can include an image to show in the middle of the loading circle by simply uncommenting:

        UIImageView *img = [[UIImageView alloc] initWithFrame:GMD_SPINNER_IMAGE];
        img.image = GMD_IMAGE; =;
        [hud addSubview:img];



    GMDCircleLoader is a neat and easy to use loading view meant to replicate Apple’s progress loading view of an ongoing task。

  • A Swift port for
Drag "MABCardsContainer.swift" to your Xcode project.
Check Demo project.



    A Swift port for ZLSwipeableView。

  • Creating rich text under iOS can be cumbersome, needing a lot of code.
The main goal of GONMarkupParser is to provide an easy to use syntax, near XML/HTML, but more flexible.
Some others projects exists, allowing you to build NSAttributedString from HTML, but my main goal here was to focus on text semantic. In fact, the parser will detect registered markups and apply style on text.
The purpose of this was to be able to generate different outputs from the same input string, without editing its content, but editing the markups style.

GONMarkupParser is not an out of the box solution to parse HTML files.

refer the detail in demo or gitHub.




Popular Code

More >
  • 实现较为完整的图片浏览器功能,效果类似iPhone自带的相册应用。包括的功能有:手指划动切换图片,点击图片隐藏导航条,放大图片、分享图片、复制图片等等。显示的图片包括本地图片、相册图片、网络图片。并且能够处理下载和cache(缓存)来自互联网图片。

    Photo Gallery


    A photo browser for the iPhone and iPod touch。

  • 基于ASIHTTP 的多线程下载管理功能模块,支持异步下载、暂停和恢复下载等等功能。暂停某个下载任务,再次恢复该下载任务时,不会重头下载,而是在已下载的地方开始下载(即断点下载)。具体有如下特色:
1. 完整的UI设计,可直接拿来使用;
2. 异步,后台,多线程(ASI提供);
3. 最大同时下载数设置;
4. 下载任务排队,暂停,等待,继续,删除某个下载任务;
5. 记录下载的未完成和已完成任务,并在下次启动时加载;
小编注:感谢开发者@Sven 发布代码于。



    Download mangement based on ASIHTTP, support pause\resume download task, multiple threads download。

  • 自定义视图变换的各种动画效果。其中包括:CALayer、UIViewAnimation、CATransition、CABasicAnimation、CAKeyframeAnimation、CAAnimationGroup、CATransform3D各个知识点实现的动画效果,实现好多特炫动画,供大家学习参考。
小编注:感谢作者@西雅图卢飞 分享代码于Code4App.

    UIViewAnimation Demo


    UIViewAnimation Demo。

  • 自定义中间有突起的UITabBar,demo中高仿了gogobot app底部不规则的TabBar。

    Custom Raised TabBar


    Custom a TabBar with raised tab on the center。

  • 实现特殊效果的UITabBar(Jamie's Recipes App的tab bar效果),开发者可以根据这份代码学习如何自定义UITabBar,包括背景、图片、以及切换动画效果等等。

    Recipe SegmentControl


    A demo project that demonstrates how to create a Jamie's Recipes style segment control。

  • 自定义 UIAlertView 的样式,包括背景颜色、边框等等,更重要的是,能够自定义 Alert View 的弹出和消失的动画,包括渐隐渐现、翻转、坠落等等。



    A completely custom UIAlertView that supports custom drawing for the core component and internal buttons。

  • 一个弹出的列表视图,视图弹出和消失都有不错的动画。类似于Android中d的Spinner。可用于替换UIActionSheet,丰富界面的视图动画效果。
小编注:感谢作者@Alfred_Kruger 分享原创代码于Code4App。



    An iOS pop up list view, like Spinner in Android。