Recently Added iOS Source Code Examples

More >
  • 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。

  • ExampleCode:
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
    HorizontalScrollCell *hsc =[collectionView dequeueReusableCellWithReuseIdentifier:@"cvcHsc"
    [hsc setBackgroundColor:[UIColor colorWithRed:255.0f/255.0f green:255.0f/255.0f blue:255.0f/255.0f alpha:0.5f]];
    [hsc setUpCellWithArray:images];
    [hsc.scroll setFrame:CGRectMake(hsc.scroll.frame.origin.x, hsc.scroll.frame.origin.y, hsc.frame.size.width, 164)];
    hsc.cellDelegate = self;
    return hsc;

please refer the demo for detail usage.



    Horizontal Scrollable Cell for ios。

  • Code samples

The simple code to get SwiftSpinner running in your own app.

In case you installed SwiftSpinner via CocoaPods you need to import it (add this somewhere at the top of your source code file):
    import SwiftSpinner
When you want to show an animated activity (eg. rings are randomly rotating around):"Connecting to satellite...")
If you want to show a static activity indicator (eg. a message with two complete rings around it)"Failed to connect, waiting...", animated: false)
When you want to hide the activity:
That's all. If you want to change the text of the current activity, just call show(...) again, this will animate the old text into the new text.


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

    pod "SwiftSpinner"



    A beautiful activity indicator and modal alert written in Swift。

  • What is this?

You can use it in the Xcode, quickly find the location of the simulator.

Currently only supports Xcode6



    You can quickly enter the iOS simulator Xcode plugin!。

  • Demo of Core Animation Introduction

Internal share demo of Core Animation technology, including CALayer introduction and its applications. In addition, demonstrated how to implement shape transform animation using layer path property.



    Demo of Core Animation Introduction。

  • Text view with font size automatically adjustment according to its frame size.

RJTextView can magnify the text's font size as you increase the textview's frame size. Otherwise, when you reduce the frame size, the font size also shrink to make the text fit inside the text view. In addition, the text font size changes in response to adding or deleting texts.



    Text view with font size automatically adjustment according to its frame size.。

  • UPStackMenu is a menu with a stack layout, that can be expanded and collapsed with some fancy animations.

UPStackMenu is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "UPStackMenu"
Simply copy the folder UPStackMenu to your project and import it in Xcode.

#import "UPStackMenu.h"
Now, you can create a UPStackMenu object by giving it a content view.
UPStackMenu *stack = [[UPStackMenu alloc] initWithContentView:aView];

Then, you can create some items that will be part of the stack.
UPStackMenuItem *item = [[UPStackMenuItem alloc] initWithImage:anImage highlightedImage:anImage title:aTitle];

Finally, add the items to the stack menu.
[stack addItems:@[item]];

The delegate is optional and will be notified when some events occur:
- (void)stackMenuWillOpen:(UPStackMenu*)menu
- (void)stackMenuDidOpen:(UPStackMenu*)menu
- (void)stackMenuWillClose:(UPStackMenu*)menu
- (void)stackMenuDidClose:(UPStackMenu*)menu
- (void)stackMenu:(UPStackMenu*)menu didTouchItem:(UPStackMenuItem*)item atIndex:(NSUInteger)index



    A fancy menu with a stack layout for iOS。

  • Usage

// Tab bar
UITabBarItem *item1 = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemBookmarks tag:1];
UITabBarItem *item2 = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemContacts tag:2];
UITabBarItem *item3 = ...

ZRScrollableTabBar *tabBar = [[ZRScrollableTabBar alloc] initWithItems:[NSArray arrayWithObjects: item1, item2, item3, item4, item5, item6, item7, item8, item9, nil]];
tabBar.scrollableTabBarDelegate = self;

[self.view addSubview:tabBar];

You will get the tabbar with selected index on delegate method

- (void)scrollableTabBar:(ZRScrollableTabBar *)tabBar didSelectItemWithTag:(int)tag

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

pod "ZRScrollableTabBar"



    An easy scrollable TabBar。

Popular Code

More >