Recently Added iOS Source Code Examples

More >
  • Custom Calendar for iOS Grid Calendar view for iOS created by Jubin Jacob (jubinjacob19@gmail.com) 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.

    CustomCalendar

    04/10/2015

    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

    04/10/2015

    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 thinkandbuild.it's swift tutorial converted into Obj-C.

Installation

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

Manually
Copy the source files MBTwitterScroll folder into your project.

Usage
#import "MBTwitterScroll.h"

UITableView

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];


UIScrollView

To show animation on UIScrollView use the following code:

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

    MBTwitterScroll

    03/30/2015

    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'
use_frameworks!
# 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.

    MediumMenu

    03/30/2015

    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!
Features
-Secret command register
-Unlock with secret command
- Show input command with animation

Installation

CocoaPods
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"

Manually
Add the SASecretCommandViewController directory to your project.

See the example project for the detail usage.

    SASecretCommandViewController

    03/27/2015

    SASecretCommandViewController。

  • 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;

    JMHoledView

    03/27/2015

    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
                               animationDuration:(NSTimeInterval)animationDuration
                                  animationCurve:(UIViewAnimationCurve)animationCurve {

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

    UIViewControllerKeyboardAdditions

    03/27/2015

    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:
        *ABCIntroView.h
        *ABCIntroView.m
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

-(void)onDoneButtonPressed{
    //    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];
    }];
}

    ABCIntroView

    03/27/2015

    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 =
    [NSDictionary
     dictionaryWithContentsOfFile:[[NSBundle mainBundle]
                                   pathForResource:@"coachmark1"
                                   ofType:@"plist"]];
    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.

    PICoachmark

    03/25/2015

    A extensible and easy coach mark libary。

  • ExampleCode:
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    HorizontalScrollCell *hsc =[collectionView dequeueReusableCellWithReuseIdentifier:@"cvcHsc"
                                                                         forIndexPath:indexPath];
        
    [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.

    HorizontalScrollCell

    03/25/2015

    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):
     SwiftSpinner.show("Connecting to satellite...")
If you want to show a static activity indicator (eg. a message with two complete rings around it)
    SwiftSpinner.show("Failed to connect, waiting...", animated: false)
When you want to hide the activity:
    SwiftSpinner.hide()
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.

Installation

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

    pod "SwiftSpinner"

    SwiftSpinner

    03/25/2015

    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

    ZLGotoSandboxPlugin

    03/25/2015

    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.

    ShareOfCoreAnimation

    03/24/2015

    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.

    RJTextView

    03/24/2015

    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.

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

Usage
#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]];

Delegate
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

    UPStackMenu

    03/23/2015

    A fancy menu with a stack layout for iOS。

  • Usage

-(void)initScrollableTabbar
{
// 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
{
....
}
Installation

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

pod "ZRScrollableTabBar"

    ZRScrollableTabBar

    03/23/2015

    An easy scrollable TabBar。

  • MovieDB is a sample app implementing several UI patterns. It was firstly built to test a few different implementations of a details page.

    MovieDBApp

    03/23/2015

    MovieDB is a sample app implementing several UI patterns。

  • This demo app will animate the view just like Youtube mobile app, while tapping on video a UIView pops up from right corner of the screen and the view can be dragged to right corner through Pan Gesture and more features are there as Youtube iOS app . The whole design is done with Auto Layout and it is compatible with iOS 6 too.

DraggableYoutubeFloatingVideo allows you to play videos on a floating mini window at the bottom of your screen from sites like YouTube, Vimeo & Facebook or custom video url , yes you have to specify URL for that.

Usage
Initialize from a storyboard id programmatically. Set the video URL , then you're pretty much good to go! Check out the demo app to see how it can be used.

How it works
This demo app will animate the view just like Youtube mobile app, while tapping on video a UIView pops up from right corner of the screen and the view can be dragged to right corner through Pan Gesture and more features are there as Youtube iOS app

    DraggableYoutubeFloatingVideo

    03/23/2015

    play videos on a floating mini window at the bottom of your screen from sites like YouTube。

Popular Code

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

    SKSTableView

    2512 downloads

    An expandable table view。

  • 一个使用ZXing库实现二维码扫描、自定义扫描控件及二维码生成的例子。项目中包含了ZXing自带扫描控件的使用,自定义扫描控件的界面,从相册中读取照片解析二维码,以及生成二维码的功能。解码使用ZXing库,编码使用QRCodeEncoder库。
小编注:感谢开发者@禁行线 分享代码于Code4App。

    ZXing Demo

    2258 downloads

    使用ZXing库实现二维码扫描、自定义扫描控件及二维码生成。

  • 利用cocos2d写的一款炸弹人游戏源码。
小编注:感谢开发者@onlyForYouFei 分享代码于Code4App。

    bomb man game

    1805 downloads

    A bomb man game made by cocos2d。

  • 利用 UITableView 实现九宫格布局。具体特点如下:
1、通过KVC的方法方便实现了九宫格,简便了实现的代码;
2、九宫格显示图片的代码,缩小截取固定大小的小图片节省内存;
3、充分利用了分类来实现九宫格;
4. 每个格子都支持点击动作。

    Simple Grid

    1779 downloads

    A very simple way to implement grid view。

  • 实现 app 中常见的搜索框(UISearchBar)在列表视图中的滚动行为。本代码实现了三种情况,一种是搜索框始终位于列表的顶部,列表的拖动时搜索框都固定不动。第二种是,列表视图刚加载时,搜索框隐藏在视图的顶部,当往下拖动列表时,搜索框才会出现,继续往下拖动列表,搜索框会随着列表的拖动而移动,当往上拖动列表时,搜索框隐藏。第三种情况和第二种情况差不多,只不过在往下拖动列表时,搜索框出现之后,会固定不动,只有往上拖动列表时才会隐藏搜索框。具体情况视频。

    TableView with SearchBar

    1745 downloads

    Small demo project for the various search bar scrolling behaviors found in Apple's apps。

  • 实现类似优酷客户端底部导航菜单按钮。效果十分炫,用户拖动列表是,导航按钮自动隐藏。点击某个按钮,更多按钮会从底部引出。具体效果请看视频。测试时,需将模拟器的语言区域设置成中国。
小编注:感谢@花语剑 分享代码于本站。

    Cool Menu

    1614 downloads

    A very cool menu for iOS。

  • 自定义地图标注MKAnnotationView。在地图Annotation上加图片,自定义Annotation的文字字体以及颜色、大小等。
小编注:感谢开发者@小子Y个 分享代码于Code4App。

    Custom MKAnnotationView

    1599 downloads

    Custom MKAnnotationView。