Recently Added iOS Source Code Examples

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

  • SAParallaxViewControllerSwift realizes parallax scrolling with blur effect. In addition, it realizes seamless opening transition.

Features
 -Parallax scrolling
 -Parallax scrolling with blur accessory view
 -Seamlees opening transition

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

Refer the example project for Usage.

    SAParallaxViewControllerSwift

    03/23/2015

    realizes parallax scrolling with blur effect and seamless opening transition。

  • Features
-spring bounds effect
-simple use
-adjustable menu item height

Installation
Grab the files in KOMenuView/ and put it in your project.

Usage
first, import KOMenuView.h
_blurMenuView = [KOMenuView menuViewWithItem:@[@"Menu 01",@"Menu 02",@"Menu 03",@"Menu 04",@"Menu 05"]
                               withPlaceView:self.view
                            withClickByIndex:^(NSInteger itemIndex) {
                                NSLog(@"itemIndex : %ld",(long)itemIndex);
                            }];
or you can custom menu item height

_blurMenuView = [KOMenuView menuViewWithItem:@[@"Menu 01",@"Menu 02",@"Menu 03",@"Menu 04",@"Menu 05"]
                                  itemHeight:60.f
                               withPlaceView:self.view
                            withClickByIndex:^(NSInteger itemIndex) {
                                NSLog(@"itemIndex : %ld",(long)itemIndex);
                            }];
you can set other funtion if you want

_blurMenuView.foldMenuWhenClickItem = YES;   ///fold menu automatically when select item, default NO
_blurMenuView.animaDuration = 0.3;          ///animation duration, default 0.25

    KOMenuView

    03/20/2015

    Simple foldable bottom menu。

  • Usage:

You can use it like a classic UIScrollView, the pagingEnabled is set to YES by default and clipsToBounds is set to NO.

#import <UIKit/UIKit.h>

#import <JT3DScrollView.h>

@interface ViewController : UIViewController

@property (weak, nonatomic) IBOutlet JT3DScrollView *scrollView;

@end
You just have to set the effect.

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.scrollView.effect = JT3DScrollViewEffectCards;
}
@end
You can disable the effect and act like a classic UIScrollView by setting effect to JT3DScrollViewEffectNone.

Effects are just preset for some properties used for the animations, you can adjust all effects with:
1.angleRatio  2.rotationX  3.rotationY 4.rotationZ  5.translateX  6.translateY
All this properties are relative to the position X of the subview.

    JT3DScrollView

    03/20/2015

    ScrollView with custom effects during the scroll for iOS。

  • VIPhotoView is a view use to view a photo with simple and basic interactive gesture. Pinch to scale photo, double tap to scale photo, drag to scoll photo.

Installation

Cocoapods

pod 'VIPhotoView', '~> 0.1'

Usage

Init VIPhotoView with frame and image, than add it to a view.

- (void)viewDidLoad {
    [super viewDidLoad];

    UIImage *image = [UIImage imageNamed:@"test.jpg"];
    VIPhotoView *photoView = [[VIPhotoView alloc] initWithFrame:self.view.bounds andImage:image];
    photoView.autoresizingMask = (1 << 6) -1;

    [self.view addSubview:photoView];
}

    VIPhotoView

    03/20/2015

    View a photo with simple and basic interactive gesture.。

Popular Code

More >
  • 模仿天猫 app 中可打开的列表样式。即点击列表任意一行,被点击的列表行(cell)会下拉打开,展示更多内容。Demo中列表下拉打开显示更多按钮,每个按钮能响应点击事件。
小编注:这份代码借鉴了Open Folder(https://github.com/jwilling/JWFolders)效果十分好。感谢开发者@Cloud-Dai 分享代码于Code4App。

    Open UITableViewCell

    3925 downloads

    Clicking a UITableViewCell, will open the cell, and show more detail view, which like the folder on iOS desk。

  • 基于 UIScrollview 的带上拉加载下一页数据和下拉刷新的瀑布流demo。本Demo使用使用 UrlImageView 实现网络图片异步加载和 EGORefresh 实现刷新。

    Pull to refresh water flow

    3223 downloads

    A water flow view which supports pull to refresh and pull to load more。

  • 仅需几行代码就可以为UITableView加上下拉刷新或者上拉刷新功能。可以自定义上下拉刷新的文字说明。具体使用看下面的“使用方法”。
2013.11.03版本代码更新功能:
1.适配iPhone横竖屏、iPad横竖屏;
2.不用再调用 free 方法来释放刷新控件的资源;
3.演示了刷新控件的block回调;
4.演示了刷新控件在UICollectionView上的使用.
作者说:网上开源的下拉-上拉刷新控件,普遍封装得过于复杂、耦合性强。因此本人特地花了点时间写了一套无耦合、可插拔式的刷新控件,对项目中的其他代码毫无侵入性,而且使用简单,3行代码就能集成刷新控件。
小编注:感谢开发者@M了个J 发布代码于Code4App.com。

    Pull to refresh

    3184 downloads

    Very easy to integrate pull to refresh and pull up to load more into app。

  • 实现视差滑动效果特别棒的ScrollView切换视图效果。手指滑动视图时,新视图的滑动进来的速度高于当前视图滑动出去的速度,所以整个视图切换效果给人十分流畅和谐的感觉。其实这份代码还实现了另外一种拖拉出现新视图的效果。手指拖动视图的温度数字,会拖拉出新视图,并且会给当前视图覆盖上渐渐模糊的效果。这两种效果在iOS7的雅虎天气App中可以看到。

    BTGlassScrollView

    2231 downloads

    Inspired by Yahoo Weather App, this easy to use view replicates the look and feel。

  • 利用 cocos2d 模仿合金弹头的特种任务做的一个demo,包括几个场景,可以发射子弹、跳跃和前进。
作者说:在iphone真机retina显示屏上能运行重力感应控制方向,单指按攻击,双指按跳跃。还没开发完毕,遇到一些困难,希望有相关经验的的前辈指点或者发送一些类似游戏demo给 stonexing5@gmail.com 。
小编注:只能在真机retina显示屏上才能正确运行。感谢开发者@草庐软件 分享代码于Code4App。

    Metal Slug Demo

    2116 downloads

    Metal Slug demo made by cocos2d。

  • 显示一组环拍照片,可用于360度展示物品。可以加载压缩成zip文件的一组图片,这样可以缩小整个app的大小。
小编注:感谢开发者@里脊串 发布代码于Code4App.com。

    MMSpinImageView

    1945 downloads

    A UIView to show 360 degree spin photography。

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

    SCCaptureCamera

    1673 downloads

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