Recently Added iOS Source Code Examples

More >
  • -iOS7 style passcode view. Supports create, change and authenticate password.
-Customizable lock policy for too many failure attempts.
-Customizable passcode digit appearance.
-Shows lock scrren when application entered background state. -Use BKPasscodeLockScreenManager
-You can authenticate passcode asynchronously. (e.g. using API to authenticate passcode)
-Supports Touch ID API in iOS 8.

    BKPasscodeView

    11/25/2014

    iOS 7 style passcode view. Supports create, change and authenticate password。

  • M13BadgeView is a customizable badge view for iOS applications. The badge is built to be customizeable in every way possible, If not customization is needed, it defaults to the same style as the iOS 7 badge. It can also align itself to its superview, and animates text changes automatically.

Features:
1.Customizable
-Border
-Gloss
-Corner Radius
-Shadows
-Colors can be customized.
-Font can be customized

2.Automatic alignment to the superview.
3.Animates text changes

More Detail in the Demo.

    M13BadgeView

    11/25/2014

    A customizable badge for iOS applications。

  • A Popover mimic Facebook app popover using UIKit.

The concept of this popover is very simple: add your contentView in a popover, then show the popover in the container view.

Usage

The API and demo is fairly straight forward. You can read details in the demo.

Showing the popover

1.make a your contentView, set its frame or bounds.
2.new a DXPopover.
3.show it.

Simple
eg:
UIImageView *imageV= [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
imageV.image = [UIImage imageNamed:@"ig20.jpg"];
DXPopover *popover = [DXPopover popover];
[popover showAtView:self.btn1 withContentView:imageV];

More conceret
eg:
[self.popover showAtPoint:yourPoint popoverPostion:DXPopoverPositionDown withContentView:self.tableView inView:self.tabBarController.view]; // 1.Set the show point 2.set The position if up or down staying the showPoint, 3.Your contentView 4.The containerView
__weak typeof(self)weakSelf = self;
self.popover.didDismissHandler = ^{ //The callback of popover dimissal.
    [weakSelf bounceTargetView:titleView];
};

    DXPopover

    11/25/2014

    A Popover mimic Facebook app popover using UIKit。

  • Usage

Implement LTInfiniteScrollViewDataSource and LTInfiniteScrollViewDelegate protocol

@protocol LTInfiniteScrollViewDataSource <NSObject>
-(UIView*) viewAtIndex:(int)index reusingView:(UIView *)view;
-(int) totalViewCount;
-(int) visibleViewCount;
@end

@protocol LTInfiniteScrollViewDelegate <NSObject>
-(void) updateView:(UIView*) view withDistanceToCenter:(CGFloat)distance scrollDirection:(ScrollDirection)direction;
@end
In the delegate method, you can apply various view transform during scrolling.

See the example for details.

    LTInfiniteScrollView

    11/24/2014

    An infinite scrollview allowing easily applying animation。

  • CocoaPods
Add pod 'AAPullToRefresh' to your Podfile.

Manually
Copy AAPullToRefresh directory to your project.

Usage
#import "AAPullToRefresh.h"
...
AAPullToRefresh *tv = [self.scrollView addPullToRefreshPosition:AAPullToRefreshPositionTop actionHandler:^(AAPullToRefresh *v){
    // do something...
    // then must call stopIndicatorAnimation method.
    [v performSelector:@selector(stopIndicatorAnimation) withObject:nil afterDelay:1.0f];
}];

Customization

Property
You can customize below properties.

tv.imageIcon = [UIImage imageNamed:@"launchpad"];
tv.borderColor = [UIColor whiteColor];
tv.borderWidth = 3.0f;
tv.threshold = 60.0f;
tv.showPullToRefresh = NO; // also remove KVO observer if set to NO.

Method
- (void)manuallyTriggered;    // Manually trigger the block.
- (void)setSize:(CGSize)size; // Zoom in/out size.

More detail in Demo.

    AAPullToRefresh

    11/24/2014

    All around pull to refresh library。

  • Installation

Drag the WZSnakeHUD file into your project.
Add #import "WZSnakeHUD.h" to the header of viewController.
Use [WZSnakeHUD showWithText:@"Loading"] method to show.

Custom
BackgroundColor:

[WZSnakeHUD showWithBackgroundColor:[UIColor purpleColor]];
MaskColor:
[WZSnakeHUD showWithMaskColor:[UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.5f]];
LineWidth:
[WZSnakeHUD showWithLineWidth:4.5f];
Dimiss:

[WZSnakeHUD hide];

    WZSnakeHUD

    11/24/2014

    A simply clean HUD showing the progerss.。

  • HOT TO USE ? LIKE THIS:

[inputHelper setupInputHelperForView:view withDismissType:InputHelperDismissTypeNone];
KeyBoard will hide when you click the doen button

[inputHelper setupInputHelperForView:view withDismissType:InputHelperDismissTypeCleanMaskView];
KeyBoard will hide when you Touch outside of the KeyBoard

[inputHelper setupInputHelperForView:view withDismissType:InputHelperDismissTypeTapGusture];
KeyBoard will hide when you Touch the view
AND YOU CAN USER THOSE METHODS FOR A CONTROLLER,JUST USE controller.view .

JUST NEED ONE LINE CODES,IT CAN AUTO ADJUST THE FRAME OF THE UITextField/UITextView/UISearchBar.

    InputHelper

    11/24/2014

    InputHelper for UITextField/UITextView/UISearchBar。

  • A Simple utility that can be added to your iOS project that allows you to notify users that you are shutting down this app. You can refer users to a different app if you like. You can also stage the rollout with a cancel button that allows users to keep using the app. Then you can set a switch to only allow download of the new app.

Add The SunSet Utility files to your project
#import the SunSetUtility.h file in your ApplicationDelegate.m
In the AppDelegate.m add the call [SunSetUtility RunSunSet]; to the - (void)applicationDidBecomeActive:(UIApplication *)application method.
Set your options in the SunSetUtilityConfiguration.m

Options

sunsetActive = This BOOL allows you turn the message on or off
sunsetCancelButtonActive = This BOOL sets the type of dialog that is displayed. Removing the cancel button forces the user to download something new or close the app.
sunsetDownloadUrl = An NSString that points to the location of the new app on the itunes store.
sunSetMessage = This is the message that will appear on the Dialog.
The SunSetUtilityConfiguration.m allows you to make changes to these settings, but ideally developers would want to have this powered by a web service. It would allow changing these settings on the fly.

    SunSetUtility

    11/24/2014

    A Simple utility that can be added to your iOS project that allows you to notify users that you are shutting down this app。

  • iOS Gesture Lock can Create,Check,Modify and Clean.
Copy the folder "LLLock" in demo to your project.
See the detail in the demo.

    lugede-LLLock

    11/21/2014

    iOS Gesture Lock can Create,Check,Modify and Clean。

  • DKTextField is A TextField can change between text and secret code.

Easy to use like simple TextField.

    DKTextField

    11/21/2014

    A TextField can change between text and secret code。

  • Support:
-Supports iPad and iPhone
-Supports landscape and portrait orientations
-Can be used inside UINavigationController
-Customizable badges

CocoaPods

If you're using CocoaPods, simply add pod 'RDVTabBarController' to your Podfile.

Drag & Drop

Add the items from RDVTabBarController directory to your project. If you don't have ARC enabled, you will need to set a -fobjc-arc compiler flag on the .m source files.

Example Usage

Initialize RDVTabBarController

The initialization is similar to the one for UITabBarController. Create an instance of the tabBarController and initialize its viewControllers.

UIViewController *firstViewController = [[RDVFirstViewController alloc] init];
UIViewController *firstNavigationController = [[UINavigationController alloc]
                                               initWithRootViewController:firstViewController];

UIViewController *secondViewController = [[RDVSecondViewController alloc] init];
UIViewController *secondNavigationController = [[UINavigationController alloc]
                                                initWithRootViewController:secondViewController];

UIViewController *thirdViewController = [[RDVThirdViewController alloc] init];
UIViewController *thirdNavigationController = [[UINavigationController alloc]
                                               initWithRootViewController:thirdViewController];

RDVTabBarController *tabBarController = [[RDVTabBarController alloc] init];
[tabBarController setViewControllers:@[firstNavigationController, secondNavigationController,
                                       thirdNavigationController]];
self.viewController = tabBarController;
Customize RDVTabBarController

Each RDVTabBarItem has selectedBackground, unselectedBackground and corresponding properties for the icons: selectedImage and unselectedImage.

UIImage *finishedImage = [UIImage imageNamed:@"tabbar_selected_background"];
UIImage *unfinishedImage = [UIImage imageNamed:@"tabbar_normal_background"];
NSArray *tabBarItemImages = @[@"first", @"second", @"third"];

RDVTabBar *tabBar = [tabBarController tabBar];

[tabBar setFrame:CGRectMake(CGRectGetMinX(tabBar.frame), CGRectGetMinY(tabBar.frame), CGRectGetWidth(tabBar.frame), 63)];

NSInteger index = 0;
for (RDVTabBarItem *item in [[tabBarController tabBar] items]) {
    [item setBackgroundSelectedImage:finishedImage withUnselectedImage:unfinishedImage];
    UIImage *selectedimage = [UIImage imageNamed:[NSString stringWithFormat:@"%@_selected",
                                                  [tabBarItemImages objectAtIndex:index]]];
    UIImage *unselectedimage = [UIImage imageNamed:[NSString stringWithFormat:@"%@_normal",
                                                    [tabBarItemImages objectAtIndex:index]]];
    [item setFinishedSelectedImage:selectedimage withFinishedUnselectedImage:unselectedimage];

    index++;
}

    RDVTabBarController

    11/21/2014

    Highly customizable tabBar and tabBarController for iOS。

  • DKTagCloudView is a tag clouds view on iOS. It can generate a random and not intersects coordinates.

How To Get Started

Installation with CocoaPods

$ pod search DKTagCloudView

-> DKTagCloudView (1.0.0)
   A tag clouds view on iOS.t can generate a random and not intersects
   coordinates.
   pod 'DKTagCloudView', '~> 1.0.0'
   - Homepage: https://github.com/zhangao0086/DKTagCloudView
   - Source:   https://github.com/zhangao0086/DKTagCloudView.git
   - Versions: 1.0.0 [master repo]
Edit your Podfile and add DKTagCloudView:

pod 'DKCarouselView', '~> x.x.x'
Add #import "DKTagCloudView.h" to the top of classes that will use it.

Create instances (Also supports xib/storyboard) :

DKTagCloudView *tagCloudView = [[DKTagCloudView alloc] initWithFrame:CGRectMake(0, 64,
                                                                                self.view.bounds.size.width,
                                                                               self.view.bounds.size.height - 64)];
[self.view addSubview:tagCloudView];
self.tagCloudView = tagCloudView;

Setup items:
self.tagCloudView.titls = @[
                         @"DKTagCloudView",@"minFontSize",@"maxFontSize",
.......
                            ];
Generates:
[self.tagCloudView generate];

Callback:
[self.tagCloudView setTagClickBlock:^(NSString *title, NSInteger index) {
    NSLog(@"title:%@,index:%zd",title,index);
}];

    DKTagCloudView

    11/21/2014

    A tag clouds view on iOS.。

  • Subclassed UITableView/UICollectionView cells that will auto calculate their size so long as AutoLayout constraints are applied correctly. For iOS 7+. Works similar to how iOS 8's auto sizing of cells work.

Cocoapods

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

Add a pod entry for HTKScrollingNavigationController to your Podfile pod 'HTKDynamicResizingCell', '~> 0.0.1'
Install the pod(s) by running pod install.
Subclass HTKDynamicResizingTableViewCell or HTKDynamicResizingCollectionViewCell where you wish to use it.
Make sure Auto-layout is setup correctly. See comments in classes for help.
Autolayout Tips:

For AutoLayout to be correct, make sure you complete the following:

For height to calculate correctly, set hugging/compression priorites for all labels. This is one of the most important aspects of having the cell size itself. setContentCompressionResistancePriority needs to be set for all labels to UILayoutPriorityRequired on the Vertical axis. This prevents the label from shrinking to satisfy constraints and will not cut off any text. i.e. [self.label setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical];

Set PreferredMaxLayoutWidth for all labels that will have a auto height. This should equal width of cell minus any buffers on sides. i.e self.label.preferredMaxLayoutWidth = defaultSize - buffers;

Set any imageView's images correctly so they have proper size. Remember if you don't set a fixed width/height on a UIImageView it will use the 1x intrinsic size of the image to calculate a constraint. So if your image isn't sized correctly it will produce an incorrect value.

    HTKDynamicResizingCell

    11/20/2014

    Subclassed UITableView/UICollectionView cells that will auto calculate their size so long as AutoLayout constraints are applied correctly。

  • Usage

Make your view controller extend LTSlidingViewController, in viewDidLoad:

self.animator = [[LTSlidingViewCoverflowTransition alloc]init]; // set the animator

UIViewController *vc1 = [self.storyboard instantiateViewControllerWithIdentifier:@"vc"];
UIViewController *vc2 = [self.storyboard instantiateViewControllerWithIdentifier:@"vc"];
UIViewController *vc3 = [self.storyboard instantiateViewControllerWithIdentifier:@"vc"];

[self addChildViewController:vc1];
[self addChildViewController:vc2];
[self addChildViewController:vc3];
And you can create custom transition by implementing LTSlidingViewTransition protocal:

@protocol LTSlidingViewTransition <NSObject>
-(void) updateSourceView:(UIView*) sourceView destinationView:(UIView*) destView withPercent:(CGFloat)percent direction:(SlideDirection)direction;
@end
See the example for details~

    LTSlidingViewController

    11/20/2014

    sliding view controller allowing custom transition。

  • A simple utility class to help achieve Safari's swipe-to-hide effect. The class can be used as a UIScrollViewDelegate or on its own. Check out the example project for simple usage.

Installation

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

pod "AFSwipeToHide"

    AFSwipeToHide

    11/20/2014

    Hide your toolbars with a swipe. Just like Safari for iOS.。

  • Usage

You'll probably be using this in a static tableview. You can set it up like this in your TableViewController:

viewDidLoad

var cell = DVDatePickerTableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: nil)
cell.leftLabel.text = "The label for the date picker."
cell.datePicker // The datepicker. Add yourself as a target like you normally would, if required.
cell.datePicker.addTarget(self, action: "datePicked:", forControlEvents: UIControlEvents.ValueChanged)
cell.date // The date. Setting will update the picker view and label.
// Add it to an array of cells or something.
didSelectRowAtIndexPath

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
  var cell = self.tableView(tableView, cellForRowAtIndexPath: indexPath)
  if (cell.isKindOfClass(DVDatePickerTableViewCell)) {
    (cell as DVDatePickerTableViewCell).selectedInTableView(tableView)
  }
  self.tableView.deselectRowAtIndexPath(indexPath, animated: true)
}
heightForRowAtIndexPath

override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
  var cell = self.tableView(tableView, cellForRowAtIndexPath: indexPath)
  if (cell.isKindOfClass(DVDatePickerTableViewCell)) {
    return (cell as DVDatePickerTableViewCell).datePickerHeight()
  }
  return super.tableView(tableView, heightForRowAtIndexPath: indexPath)
}

    DVDatePickerTableViewCell

    11/17/2014

    Inline/Expanding date picker for table views.。

  • EAColourfulProgressView is a custom progress view where the current filling colour is generated between two colours, based on the current value.

It takes advantages of IBDesignable and IBInspectable so that you can completely customize with without leaving the Interface Builder.

It gives you the possibility to update the current value by calling:
- (void)updateToCurrentValue:(NSInteger)currentValue animated:(BOOL)animated;

Installation Cocoapods

Add this in your Podfile

pod 'EAColourfulProgressView', '~> 0.1.0'
Usage

Set the Custom Class of a UIView to EAColourfulProgressView in Interface Builder, customize the available variables and see them being live rendered ;)

    EAColourfulProgressView

    11/17/2014

    Custom progress view where the current filling colour is generated between two colours, based on the current value。

  • MDMenuViewController is an iOS container view controller that coordinates between its content view controllers through a side menu that is shown from the side with appealing animation , supports iOS 6.0 , 7.0 , 8.0 ,iPhone ,And iPad , Customisable in almost every aspect ,provided with documentation ,And a demo app to get you going right away.

    MDMenuViewController

    11/17/2014

    an iOS container view controller that coordinates between its content view controllers through a side menu。

Popular Code

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

    DownLoadManager

    2861 downloads

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

  • 类似于Faceboo App的Stacked View。点击主界面上的一个按钮时,主界面左边滑动一半显示出一个子视图,点击列表上任意一行,右边部分出现新内容,左边子视图滑出界面。当对左边视图进行搜索时,左边一半界面的视图变成全界面显示搜索内容。

    SideBar Navigation

    2347 downloads

    A clone of the new Facebook iOS UI paradigm。

  • 给照片和相机加上各种滤镜效果。这份代码的滤镜效果使用的是GPUImage(http://code4app.com/ios/GPUImage/500f73c76803fa062c000000),可以看做是GPUImage的使用例子。

    Image Picker Filter

    2251 downloads

    ImagePickerController with live filters, radial blur and more. Brought to you by Backspaces。

  • Pinch手势对图片进行缩放。即用两根手指往不同方向拖拉照片,照片会被缩小或放大。
作者说:在本站见到过一些照片缩放的例子,都是用ScrollerView设置的,总感觉有点飘浮。本例子用简单地手势控制照片的缩放。
小编注:感谢开发者@基调中国 分享代码于Code4App。

    scale an image by pinch

    1749 downloads

    Use pinch gesture to scale an image。

  • 实现网格化视图(Grid View),或者可以视作为多列的表格(multiple column table)。每个网格视图支持点击动作。

    Grid Table View

    1688 downloads

    UIGridView offers a simple way to use a grid (multiple-column UITableView) on iOS。

  • 实现效果多样的HUD。这是小编看过的效果最多样化的HUD。可以设置很多关于HUD动画和外观的参数。包括,可以设置HUD是否有边框(border),设置HUD出现和消失的方式(包括上下、左右、淡入淡出、放大缩小等等),设置HUD的内容(可以在HUD中加入帧动画、动态图片等等),设置HUD出现时的底部覆盖层颜色,等等。总而言之,这是一份集大成的HUD代码。慢慢看视频吧,囊括了所有效果。
小编注:不过,可惜的是这么多效果,却没有扁平化风格(Flat UI)的效果。

    MMProgressHUD

    1651 downloads

    An easy-to-use HUD interface with personality。

  • 以Kal日历控件为基础,界面更新为IOS7扁平化风格。并且可以设置单选和范围选择两种模式。还可以设置初始选择日期和可选日期的范围。
作者说:Kal是一个日历控件(http://code4app.com/ios/4f7049e56803fad237000000),但是已经很久没有更新了。这是我的fork。
小编注:感谢开发者@文祥 发布代码于Code4App.com。

    Kal for IOS 7

    1553 downloads

    A calendar component for the iPhone (the UI is designed to match MobileCal)。