Recently Added iOS Source Code Examples

More >
  • A super simple and beautiful and high-efficiency clock widget. Drawing views using Quartz 2D Completely.
Usage:
#import "DDClock.h"
DDClock *clock = [[DDClock alloc] initWithTheme:DDClockThemeDefault position:CGPointMake(([UIScreen mainScreen].bounds.size.width - 200 )/2, 50)]; 
[self.view addSubview:clock];

    DDClock

    01/30/2015

    A super simple and beautiful and high-efficiency clock widget。

  • A simple, horizontally-scrolling list of items that can be used as a more flexible replacement for UISegmentedControl

Add HTHorizontalSelectionList pod into your Podfile

pod 'HTHorizontalSelectionList', '~> 0.2.4'
Usage
Setup and Initialization
To begin using HTHorizontalSelectionList, import the main header:

#import <HTHorizontalSelectionList/HTHorizontalSelectionList.h>
The horizontal selection list uses a data-source/delegate model (similar to UITableView or UIPickerView). To setup a simple horizontal selection list, init the view and set it's delegate and data source:

@interface CarListViewController () <HTHorizontalSelectionListDataSource, HTHorizontalSelectionListDelegate>

@property (nonatomic, strong) HTHorizontalSelectionList *selectionList;
@property (nonatomic, strong) NSArray *carMakes;

@end

@implementation CarListViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.selectionList = [[HTHorizontalSelectionList alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 30)];
    selectionList.delegate = self;
    selectionList.dataSource = self;

    self.carMakes = @[@"ALL CARS",
                      @"AUDI",
                      @"BITTER",
                      @"BMW",
                      @"BÜSSING",
                      @"GUMPERT",
                      @"MAN"];
}

#pragma mark - HTHorizontalSelectionListDataSource Protocol Methods
- (NSInteger)numberOfItemsInSelectionList:(HTHorizontalSelectionList *)selectionList {
    return self.carMakes.count;
}
- (NSString *)selectionList:(HTHorizontalSelectionList *)selectionList titleForItemWithIndex:(NSInteger)index {
    return self.carMakes[index];
}

#pragma mark - HTHorizontalSelectionListDelegate Protocol Methods
- (void)selectionList:(HTHorizontalSelectionList *)selectionList didSelectButtonWithIndex:(NSInteger)index {
    // update the view for the corresponding index
}
You'll see some properties in HTHorizontalSelectionList.h so you can change them.

    HTHorizontalSelectionList

    01/30/2015

    A simple, horizontally-scrolling list of items that can be used as a more flexible replacement for UISegmentedControl。

  • AFMInfoBanner can be used to unobtrusively notify users about successful or erroneous events which do not require any specific action or UI locking. Good examples are network errors on the screens which can be functional even without the data that failed.

View is trying to find a navigation bar and show itself beneath it. If that fails, it shows from top of the window, adjusting height to be below status bar. View is resized to any text, but auto-hiding interval makes long text hard to read, so it's better to keep it short.

Background and text colours, as well as font are customisable through UIAppearance.

Usage

There are two styles: AFMInfoBannerStyleError for error messages and AFMInfoBannerStyleInfo for other, like info or success notices. By default error is red and info is green.

Easiest way to use it is calling a class method passing text and kind of message:

[AFMInfoBanner showAndHideWithText:@"Error text" style:AFMInfoBannerStyleError];
If you need another hiding interval, you can pass it like this:

[AFMInfoBanner showWithText:@"Error text" style:AFMInfoBannerStyleError andHideAfter:1.0];
If you want to create or show it yourself, as well as have a overriding point in case of inheritance, there are -show: and -hide: methods available.

If you need to hide any possibly showing banner, use +[AFMInfoBanner hideAll]. Possible case for this is navigating away from the page. Without this banner is going to stay visible during navigation because it is attached to navigation bar's view.

You can use Example project to play around with AFMInfoBanner. To run the example project, clone the repo, and run pod install from the Example directory first.

    AFMInfoBanner

    01/29/2015

    Easy to use auto-hiding notice bar below Navigation Bar。

  • Installation
With CocoaPods, add this line to your Podfile.
pod 'JTBorderDotAnimation', '~> 1.0'

Usage

Basic usage

Just import JTBorderDotAnimation.h.

#import "JTBorderDotAnimation.h"

@interface ViewController : UIViewController

@property (weak, nonatomic) IBOutlet UIView *animatedView;

@property (strong, nonatomic) JTBorderDotAnimation *dotAnimation;

@end
Assign the view you want to animate and start the animation.

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.dotAnimation = [JTBorderDotAnimation new];
    self.dotAnimation.animatedView = self.animatedView;
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];

    [self.dotAnimation start];
}
Customization

You can easily customize the animation.

numberPoints
duration
repeatCount
pointSize
pointColor
Example:

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.dotAnimation = [JTBorderDotAnimation new];
    self.dotAnimation.animatedView = self.animatedView;

    self.dotAnimation.numberPoints = 6;
    self.dotAnimation.duration = 6.;
    self.dotAnimation.repeatCount = 3;
    self.dotAnimation.pointSize = 5.;
    self.dotAnimation.pointColor = [UIColor orangeColor];
}

    JTBorderDotAnimation

    01/29/2015

    simple animation with dots turning around a UIView for iOS。

  • Installation

CocoaPods

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

pod "UPCardsCarousel"
Manual

Simply copy the folder UPCardsCarousel to your project and import it in XCode.

Usage

Start by importing the header file:

#import "UPCardsCarousel.h"
Now, you can create a UPCardsCarousel object by giving it a frame:

UPCardsCarousel *carousel = [[UPCardsCarousel alloc] initWithFrame:aFrame];
Then you need to assign to it:

a delegate object that conforms to the UPCardsCarouselDelegate protocol
a dataSource object that conforms to the UPCardsCarouselDataSource protocol
Data Source

The data source informs the carousel about the total number of cards and the content of each card through two self-explanatory methods:

- (NSUInteger)numberOfCardsInCarousel:(UPCardsCarousel *)carousel (required)
- (UIView *)carousel:(UPCardsCarousel *)carousel viewForCardAtIndex:(NSUInteger)index (required)
The labels in the banner are given with an optional method. If the data source doesn't implement this method, the label banner will not be displayed.

- (NSString *)carousel:(UPCardsCarousel *)carousel labelForCardAtIndex:(NSUInteger)index (optional)
Delegate

The delegate is optional and will be notified when some events occur:

- (void)carousel:(UPCardsCarousel *)carousel didTouchCardAtIndex:(NSUInteger)index
- (void)carousel:(UPCardsCarousel *)carousel willDisplayCardAtIndex:(NSUInteger)index
- (void)carousel:(UPCardsCarousel *)carousel willHideCardAtIndex:(NSUInteger)index
- (void)carousel:(UPCardsCarousel *)carousel didDisplayCardAtIndex:(NSUInteger)index
- (void)carousel:(UPCardsCarousel *)carousel didHideCardAtIndex:(NSUInteger)index

    UPCardsCarousel

    01/29/2015

    A cards based carousel for iOS。

  • A radial menu that considers also screen edges, reorganizing buttons in order to get them always inside the screen.

Please refer the Usage in the Demo.

    LNERadialMenu

    01/27/2015

    LNERadialMenu。

  • UCZProgressView is a circular progress indicator with cool animations for image loading.

This progress view is inspired by Michaël Villar's motion effect 08-Photo Loading.

-Customizable indicator (line width, radius, and color)
-Display a label with the current progress.
-Customizable progress text label (color, size and font)
-Customizable background view (blur style)
-Fully support interface builder (IB_DESIGNABLE and IBInspectable)
-Fully support UI_APPEARANCE_SELECTOR

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

Refer the Detail in Demo.

    UCZProgressView

    01/27/2015

    UCZProgressView is a circular progress indicator for image loading.。

  • Easily add a Settings.bundle with CocoaPods' acknowledgements to your iOS App.

Installation

Add pod 'AcknowledgementsBundle' to your CocoaPods' Podfile:

platform :ios

pod 'AcknowledgementsBundle'

# ...more Pods!
Done! No code needed.

    AcknowledgementsBundle

    01/27/2015

    Easily add a Settings.bundle with CocoaPods' acknowledgements to your iOS App.。

  • a bubble control highly inspired from facebook chat heads.
written in swift.

Usage

Copy & paste the BubbleControl.swift into your project

init with size or image

    bubble = BubbleControl (size: CGSizeMake(80, 80))

    bubble = BubbleControl (image: UIImage (named: "image.png"))
set it content view (if you want to opens a content view)

  let contentView = UIView ()
  ....

  bubble.contentView = contentView
set content view open/close animations

  bubble.setOpenAnimation = { content, background in
      self.bubble.contentView!.bottom = win.bottom
      if (self.bubble.center.x > win.center.x) {
          self.bubble.contentView!.left = win.right
          self.bubble.contentView!.spring({ () -> Void in
              self.bubble.contentView!.right = win.right
          }, completion: nil)
      } else {
          self.bubble.contentView!.right = win.left
          self.bubble.contentView!.spring({ () -> Void in
              self.bubble.contentView!.left = win.left
          }, completion: nil)
      }
and other optional handlers

    var didToggle: ((Bool) -> ())?
    var didNavigationBarButtonPressed: (() -> ())?
    var didPop: (()->())?
Optional Values

    var snapsInside: Bool = false
    var popsToNavBar: Bool = true
    var movesBottom: Bool = false

    BubbleControl-Swift

    01/27/2015

    a bubble control highly inspired from facebook chat heads. written in swift。

  • Installation

If you're using CocoaPods, just add this line to your Podfile:
pod 'AFDropdownNotification', '~> 1.0'

If you're not, import these files to your project:
AFDropdownNotification.h
AFDropdownNotification.m

Usage
First of all, init your AFDropdownNotification class and set your main class as AFDropdownNotificationDelegate:

AFDropdownNotification *notification = [[AFDropdownNotification alloc] init];
notification.notificationDelegate = self;
You can configure the title text with the titleText property, the subtitle text with subtitleText, an optional left image defined as image, and two optional buttons, with topButtonText and bottomButtonText. For example:

notification.titleText = @"Update available";
notification.subtitleText = @"Do you want to download the update of this file?";
notification.image = [UIImage imageNamed:@"update"];
notification.topButtonText = @"Accept";
notification.bottomButtonText = @"Cancel";
If you want to hide the notification by tapping it, set dimissOnTap to YES:

notification.dismissOnTap = YES;
To present it, you can choose if you want to use UIKit dynamics (which will include a subtle bounce) or a regular lineal UIKit animation:

[notification presentInView:self.view withGravityAnimation:YES];
Finally, to handle the buttons taps, implement the two methods defined by the delegate, -dropdownNotificationTopButtonTapped and -dropdownNotificationBottomButtonTapped.

-(void)dropdownNotificationTopButtonTapped {

    NSLog(@"Top button tapped");
}
-(void)dropdownNotificationBottomButtonTapped {

    NSLog(@"Bottom button tapped");
}

    AFDropdownNotification

    01/27/2015

    Dropdown notification view for iOS。

  • An animated bubble menu using the pop animation library (https://github.com/facebook/pop). The menu is fully customizable in terms of radius, number of items, animation speed, bounciness, background, alpha ect.

 please refer the usage in the demo or gitHub.

    LIVBubbleMenu-iOS

    01/26/2015

    An animated and customisable bubble menu for iOS8。

  • iOS Simple PullToRefresh Library.

Manually
Add the following files to your project. pulltorefresharrow.png PullToRefreshView.swift PullToRefreshConst.swift UIScrollViewExtension.swift

Usage
In your UIViewController Including UITableView, UICollectionView, UIScrollView:

  override func viewDidLoad() {
        self.tableView.addPullToRefresh({ () -> () in
            // refresh code

            self.tableView.reloadData()
            self.tableView.stopPullToRefresh()
        })
  }
If you want to fixed pulltoRefreshView, please implement scrollViewDidScroll.

  func scrollViewDidScroll(scrollView: UIScrollView) {
    self.tableView.fixedPullToRefreshViewForDidScroll()
  }  
If you want to use the custom option, please change the PullToRefreshConst class.

struct PullToRefreshConst {
    static let backgroundColor = UIColor(red: 236/255, green: 240/255, blue: 241/255, alpha: 1.0)
    static let imageName: String = "pulltorefresharrow.png"
    static let height: CGFloat = 80
    static let duration: Double = 0.5
    static let tag = 810
    static let alpha = true
}

    PullToRefreshSwift

    01/26/2015

    iOS Simple Cool PullToRefresh Library. It is written in pure swift。

  • Simply add pod 'PTEHorizontalTableView' to your CocoaPods' Podfile.

platform :ios, '5.0'
pod 'PTEHorizontalTableView'

Features:
-PTEHorizontalTableView wraps a UITableView rotated horizontally using a CGAffineTransform whose cells' content views are rotated back vertically.
-PTETableViewDelegate very similar to the standard -UITableViewDelegate with some method name such as tableView:widthForCellAtIndexPath:.
-Support for standard scroll indicators, headers and footers.
-Full Interface Builder support including creating Static/Prototype -Cells using Storyboards.

Refer the Usage in the Demo.

    PTEHorizontalTableView

    01/26/2015

    Horizontal UITableView inspired by EasyTableView.。

  • CLWeeklyCalendarView is a scrollable weekly calendarView for iPhone. It is easy to use and customised.

Usage:
Drag the CLWeeklyCalendarViewSource folder into your project.

Using CLWeeklyCalendarViewSource in your app will usually look as simple as this :

//Initialize
-(CLWeeklyCalendarView *)calendarView
{
    if(!_calendarView){
        _calendarView = [[CLWeeklyCalendarView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 100)];
        _calendarView.delegate = self;
    }
    return _calendarView;
}

//Add it into parentView
[self.view addSubview:self.calendarView];

Refer the detail in demo or gitHub.

    CLWeeklyCalendarView

    01/26/2015

    Weekly calendar view for iphone, scrollable。

  • Features:
-Easy to use - setup a basic radial menu in just a few lines of code.
-Works out of the box or customize to your heart's content.
-Full featured delegate protocol to react to or interrupt interactions.
-Interactive development mode - adjust menu inside your own app in real time

Simply drag CKRadialMenu.h and CKRadialMenu.m into your project.
Cocoa pod support coming soon.

Refer the detail in the Demo.

    CKRadialMenu

    01/23/2015

    An iOS framework for customizable radial popout menus。

  • Modeled after iOS7 style segmented controls, simple, practical!

Easycode:
float init_y = 0;
    for (int i=0; i<10; i++) {
        RFSegmentView* segmentView = [[RFSegmentView alloc] initWithFrame:CGRectMake(0, 10+init_y, kScreenWidth, 60) items:@[@"spring",@"summer",@"autumn",@"winnter"]];
        segmentView.tintColor = [self getRandomColor];
        segmentView.delegate = self;
        [self.view addSubview:segmentView];
        init_y +=60;
    }

delegate:
- (void)segmentViewSelectIndex:(NSInteger)index
{
    NSLog(@"current index is %d",index);
}

    RFSegmentView

    01/23/2015

    Modeled after iOS7 style segmented controls, simple, practical!。

  • A hardware-accelerated audio visualization view using EZAudio, inspired by AudioCopy. ZLHistogramAudioPlot was originally developed for Murmur.

CocoaPods:
You can install ZLHistogramAudioPlot through CocoaPods adding the following to your Podfile:
pod 'ZLHistogramAudioPlot'

Usage:
Customizable attributes:
/// The upper bound of the frequency range the audio plot will display. Default:
/// 10000Hz
@property (nonatomic) float maxFrequency;

/// The lower bound of the frequency range the audio plot will display. Default:
/// 1200Hz
@property (nonatomic) float minFrequency;

/// The number of bins in the audio plot. Default: 30
@property (nonatomic) NSUInteger numOfBins;

/// The padding of each bin in percent width. Default: 0.1
@property (nonatomic) CGFloat padding;

/// The gain applied to the height of each bin. Default: 10
@property (nonatomic) CGFloat gain;

/// A float that specifies the vertical gravitational acceleration applied to
/// each bin. Default: 10 pixel/sec^2
@property (nonatomic) float gravity;

/// The color of all bins in the audio plot.
@property (strong, nonatomic) UIColor *color;

/// An array of color objects defining the color of each bin in the audio plot.
/// If not set, the color attribute will be used instead. Currently only
/// supported by plot type EZPlotTypeBuffer.
@property (strong, nonatomic) NSArray *colors;

Dependencies:
ZLHistogramAudioPlot is a subclass of EZAudioPlot. It requires EZAudio.
It also requires Accelerate framework for hardware acceleration.

Compatibilty:
ZLHistogramAudioPlot uses the following interface provided by EZAudio to get audio data:
- (void)updateBuffer:(float *)buffer withBufferSize:(UInt32)bufferSize;
It can be easily modified to work with Audio Unit and Core Audio.

Checkout the demo app for an example.

    ZLHistogramAudioPlot

    01/23/2015

    A hardware-accelerated audio visualization view using EZAudio, inspired by AudioCopy.。

  • Benefits of using the Font:
-Import is easier to project(Since held together in one file)
-Color easy to change
-Resistant to change size
-Management easier
-Put out in the text as part of the AttributedString

Manually:
Add the GoogleIcon.swift, googleicon.ttf file to your project.
info.plist added Fonts provided by application key and
specify the googleicon.ttf to Item0 value.

Usage:
Please look at the icon/googleicon.html.
googleicon.html has been icon code definition.
The constant of icon code is defined in GoogleIcon class, please use.

GoogleIcon.e600
GoogleIcon.e601
GoogleIcon.e602
GoogleIcon.e603
...

hogeLabel.font = UIFont(name: GoogleIconName, size: 30.0)
hogeLabel.textColor = UIColor.greenColor()
hogeLabel.text = GoogleIcon.e600

You can also be set font in the storyboard. 
Refer the detail in the Demo.

    GoogleMaterialDesignIcons

    01/22/2015

    Google Material Design Icons Font for iOS。

Popular Code

More >