Recently Added iOS Source Code Examples

More >
  • To add to your app, simply create a ZoomTransition by passing the current NavigationController Then set the ZoomTransition object be the NavigationController delegate

if let navigationController = self.navigationController {
    self.animationController = ZoomTransition(navigationController: navigationController)
}
self.navigationController?.delegate = animationController

    ZoomTransition

    10/21/2014

    An easy to use interactive zoom transition for presenting view controllers onto a navigation stack. This transition mimics the iOS 7 & 8 photos app.。

  • Project allows for expanding menus in left, right, up, and down directions. Using the class is as simple as setting your home button and adding an array of menu buttons.

    DWBubbleMenuButton

    10/21/2014

    DWBubbleMenuButton is a simple animation class for expanding and collapsing a variable sized menu。

  • DVSwitch was inspired by UISwitch and UISegmentedControl. The goals of this code are:

Easily customizable control with nice animations
Supporting pan or swipe interactions
Requires very little setup - images are not needed
Beautiful font color inversion effect - label color changes per pixel:
Automatic adjustment based on number of items

    DVSwitch

    10/21/2014

    Customizable control based on UISwitch and UISegmentedControl written in Objective-C。

  • Create a RSdotsView and add it to a view (or use storyboard)
  var dots = RSDotsView(frame: CGRectMake(50, 50, 300, 300))
  self.view.addSubview(dots)
Change the dotsColor
  dots.dotsColor = UIColor.redColor()
Start or Stop animating the dots
  dots.startAnimating()
  dots.stopAnimating()

    RSDotsView

    10/21/2014

    A simple view that show pulsing dots。

  • UIImage *image0 = [UIImage imageNamed:@"main-camera-button"];
UIImage *image1 = [UIImage imageNamed:@"main-library-button"];
NSArray *images = @[image0, image1];

    PicsLikeControl

    10/20/2014

    A kind of customized button (users can customize the function of the button with a simple fling)。

  • Circle shaped control to select given number of values.

Structure:

There are three kinds of objects:

NOCircleSelector, which is an UIView and represents the whole area where the control is drawn. MIN(selector.width, selector.height) / 2 is the radius of selector.
NOCircleDot, which is an UIView and represents the single dot. The size and all properties can be changed via properties. Don't forget about normal UIView properties. The control is easy to subclass so you can easily add custom views. To access it use delegate methods or dots array of NOCircleSelector.
NOCircleDotConnection - a model class, representing the line between two NOCircleDot. You can customise it via properties. To access it use delegate methods or dotConnections array of NOCircleSelector. The recommended method to differ the dot is to use NS_ENUM and set tags of these.
Customisable:

In NOCircleSelector (+ all UIView properties like backgroundColor etc):

numberOfDots
[_circleSelector setNumberOfDots:4];
dotRadius
[_circleSelector setDotRadius:50.f];
lineWidth - sets defaults in NOCircleDotConnection
[_circleSelector setLineWidth::2.f];
lineColor - sets defaults in NOCircleDotConnection
[_circleSelector setLineColor:[UIColor redColor]];
fillColor
[_circleSelector setFillColor:[UIColor blueColor]];
In NOCircleDot (+ all UIView properties like backgroundColor etc):

lineWidth
[dot setLineWidth:2.f];
lineColor
[dot setLineColor:[UIColor redColor]];
fillColor
[dot setFillColor:[UIColor greenColor]];
textLabel
[dot.textLabel setText@"Hello!"];
imageView
[dot.imageView setImage:[UIImage imageNamed:@"girl"]];
angle - degrees, represents current angle of dot in selector
[dot setAngle:90.f];
minAngle - degrees, represents non crossable minimum range of dot in selector. Default 0.
[dot setMinAngle:0.f];
maxAngle - degrees, represents non crossable maximum range of dot in selector. Default 360.
[dot setMaxAngle:360.f];
In NOCircleDotConnection:

startDot - set automatically, do not overload if not required. Describes the first dot of connection.
endDot - set automatically, do not overload if not required. Describes the second dot of connection.
connectionColor
[connection setConnectionColor:[UIColor redColor]];
lineWidth
[connection setLineWidth:3.f];
dotConnectionBeetweenTag1:tag2: - convenience method to compare whether 2 dots are connected.
[dot setLineWidth:2.f];

    NOCircleSelector

    10/20/2014

    Circle shaped control to select given number of values.。

  • NSMutableArray *dropdownItems = [[NSMutableArray alloc] init];
IGLDropDownItem *item = [[IGLDropDownItem alloc] init];
[item setIconImage:[UIImage imageNamed:@"icon.png"]];
[item setText:@"title"];
[dropdownItems addObject:item];

    IGLDropDownMenu

    10/20/2014

    An iOS drop down menu with pretty animation.。

  • MagnetPopupPicker
Simple and easy to use drop down substitution for IOS.

Usage:

self.button = [[PopupPickerButton alloc] initWithFrame:CGRectMake(11, 50, 150, 30)];

[self.button setTitle:@"Select" forState:UIControlStateNormal];

NSArray *list = [NSArray arrayWithObjects:[KeyValuePair keyValuePairWithKeyAndValue:@"test1" value:@"Test 1"], [KeyValuePair keyValuePairWithKeyAndValue:@"test2" value:@"Test 2"], [KeyValuePair keyValuePairWithKeyAndValue:@"test3" value:@"Test 3"], nil];

[self.button setOptions:list keyNames:[KeyValuePair keyValuePairWithKeyAndValue:@"key" value:@"value"]];

    MagnetPopupPicker

    10/20/2014

    Simple and easy to use drop down substitution for IOS.。

  • KINWebBrowser consists of a single component:

KINWebBrowserViewController - a UIViewController that contains a full featured web browser.

KINWebBrowserViewController must be contained in a UINavigationController.

Pushing to the navigation stack:

KINWebBrowserViewController *webBrowser = [KINWebBrowserViewController webBrowserViewController];
[self.navigationController pushViewController:webBrowser animated:YES];
[webBrowser loadURLString:@"http://www.example.com"];

    KINWebBrowser

    10/17/2014

    KINWebBrowser is a web browser module for your apps.。

  • this doesn't use AHEasing, instead it uses CAMediaTimingFunction. Created mainly because the previously mentioned repo doesn't support ios8 and results in spazzy animations and also has problems with 64bit architecture.

    UIView+Easing

    10/17/2014

    Inspired from UIView-EasingFunctions with some difference in implementation。

  •  JBSpacer calculates optimal spacing for a grid of items while maintaining a specified ratio between inner gutter and outer margin sizes

Requirements

JBSpacer has been built and tested for iOS 8, though it should work with iOS 6 and later. Also, while JBSpacer may work for Mac development with slight modification (for example, to accomodate NSCollectionView), I have not tried this myself.

Usage

Add JBSpacer.h/.m and JBSpacerOption.h/.m to your project. Then:

#import "JBSpacer.h"
To configure an option:

JBSpacerOption *option = [JBSpacerOption optionWithItemSize:50.0f
                                              minimumGutter:2.0f
                                        gutterToMarginRatio:1.0f
                                              availableSize:320.0f
                                   distributeExtraToMargins:YES]];
The spacer performs its calculations in a single dimension, assuming that the second dimension (for example, in a UICollectionView) will scroll. In this example, both the itemSize and availableSize parameters represent widths, though they could just as easily be used as heights in other layout scenarios.

The gutterToMarginRatio parameter is a factor that represents the acceptable margin size as it relates to the gutter size. In this example, the minimumGutter parameter is set to 2.0, so the minimum margin size would be 2.0 x 1.0 = 2.0. If the final gutter size was 3.5, the margin size would also be 3.5, and so on.

The distributeExtraToMargins parameter controls whether any extra space should be distributed into the margins. Not all calculations result in perfect solutions, and this is a way to hide the extra space while maintaining a pleasant balance. Because calculations are performed at the pixel (not point) level, there is typically very little extra space to account for, and it can easily hide in the margins without significantly impacting the gutterToMarginRatio.

To calculate spacing, create a JBSpacer with the specified option:

JBSpacer *spacer = [JBSpacer spacerWithOption:option];
The spacing property of the spacer contains the results of the calculation.

To consider multiple options, call findBestSpacingWithOptions:. This provides the spacer with more than one acceptable solution, and it will find the solution with the tightest presentation:

BOOL success = [spacer findBestSpacingWithOptions:
                @[[JBSpacerOption optionWithItemSize:78.5f
                                       minimumGutter:2.0f
                                 gutterToMarginRatio:0.0f
                                       availableSize:320.0f
                            distributeExtraToMargins:YES],
                  [JBSpacerOption optionWithItemSize:78.5f
                                       minimumGutter:2.0f
                                 gutterToMarginRatio:1.0f
                                       availableSize:320.0f
                            distributeExtraToMargins:YES]]];
To use the optimal spacing with a UICollectionView, apply the results to an instance of UICollectionViewFlowLayout:

[spacer applySpacingToCollectionViewFlowLayout:flowLayout];
And that's it. Enjoy!

    JBSpacer

    10/17/2014

    JBSpacer calculates optimal spacing for a grid of items while maintaining a specified ratio between inner gutter and outer margin sizes。

  • A view controller subclass that presents placeholder views based on content, loading, error or empty states.

Usage
Configure the loadingView, emptyView and errorView properties of your StatefulViewController subclass in viewDidLoad.

After that, simply tell the view controller if content is currently being loaded and it will take care of showing and hiding the correct loading, error and empty view for you.

func loadDeliciousWines() {
    startLoading()

    let url = NSURL(string: "http://example.com/api")
    let session = NSURLSession.sharedSession()
    let task = session.dataTaskWithURL(url) { (let data, let response, let error) in
        endLoading(error: error)
    }
    task.resume()
}

    StatefulViewController

    10/17/2014

    A view controller subclass that presents placeholder views based on content, loading, error or empty states.。

  • It includes a many options for controlling how your popup appears and behaves.

Please feel free to contribute to this project, open issues, make suggestions and submit pull-requests. If you use this project in your app, let me know. I'd love to see what you do with it.

    CNPPopupController

    10/16/2014

    CNPPopupController is a simple and versatile class for presenting a custom popup in a variety of fashions.。

  • Wethr provides developers the ability to add location-based current weather conditions to their views as simply as adding any UIView. All you need to do is set up the frame and add it to your view and we'll handle getting the current weather conditions based on the user's location.

    WethrView *wethrView = [[WethrView alloc] initWithFrame:CGRectMake(10, 10, 200, 200)];
    [self.view addSubview:wethrView];

    Wethr

    10/16/2014

    Wethr provides developers the ability to add location-based current weather conditions 。

  • TimeLine control is a simple drop in solution to show progress of some event e.g. track order

To use it in your application follow this steps:

drag TimeLineControl folder to project
import "TimeLineViewControl.h"
and initialize view
NSArray *times = @[@"sun",@"mon",@"tue",@"wed",@"thr",@"fri",@"sat"];
NSArray *descriptions = @[@"state 1",@"state 2",@"state 3",@"state 4",@"very very long description if state 5",@"state 6",@"state 7"];
TimeLineViewControl *timeline = [[TimeLineViewControl alloc] initWithTimeArray:times
                                                       andTimeDescriptionArray:descriptions
                                                              andCurrentStatus:4];
timeline.center = self.view.center;
[self.view addSubview:timeline];
To deal with autoLayOut I've used Masonry library. It lays inside Timeline control folder. You don't need to do some additional steps to deal with it, just something to be aware of =)

That is it!

You can check ExampleProject to see how timeline works

    timeLineiOS

    10/16/2014

    A simple drop in solution to show progress of some event。

  • Simple style and Simple way to integrate pull down refresh and pull up fresh
#import "UIScrollView+DXRefresh.h"
[self.tableView addFooterWithTarget:self action:@selector(refreshFooter)];

    DXRefresh

    10/15/2014

    Simple style and Simple way to integrate pull down refresh and pull up fresh。

  • OTCover *test = [[OTCover alloc] initWithTableViewWithHeaderImage:[UIImage imageNamed:@"image.png"] withOTCoverHeight:200];

    OTCover

    10/15/2014

    An view like Medium Personal page for iOS。

  • Animated Alert View written in Swift but ported to Objective-C, which can be used as a UIAlertView or UIAlertController replacement.

    SCLAlertView

    10/15/2014

    Animated Alert View, which can be used as a UIAlertView or UIAlertController replacement.。

Popular Code

More >
  • 实现简单的阅读器功能。包括首页的书架,滑动书架界面可以切换书架。点击书架上的书籍之后,进入阅读界面,有翻页的动画效果。可以加载显示txt文件。
小编注:感谢开发者@过客笑傲人生 分享代码于Code4App。

    simple ebook reader demo

    3322 downloads

    A simple ebook reader demo。

  • 实现效果很棒的展开 table cell 显示更多内容的列表功能。

    HVTableView

    2818 downloads

    UITableView with expand/collapse feature (fully animatable)。

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

    SKSTableView

    2512 downloads

    An expandable table view。

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

    Photo Browser

    1970 downloads

    A photo browser similar to the native Photos app in iOS。

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

    Recipe SegmentControl

    1883 downloads

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

  • 实现饼状的菜单。菜单上的按钮呈现饼状排列,用户用手指滑动选择。这种菜单常见于播放器应用。

    Pie Menu

    1733 downloads

    A pie menu implementation specially designed for iPhone and iPod touch。

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

    MMProgressHUD

    1651 downloads

    An easy-to-use HUD interface with personality。