Recently Added iOS Source Code Examples

More >
  • CCMPlayNDropView is an easy to use view that with the help of UIKit dynamics animations it creates an effect similar to that used in the swarm app when dismissing views.

It can be easily integrated with the MaryPopin pod to create a nice in and out animation.

Usage

In the storyboard draw a view to your controller and assign it the CCMPlayNDropView class. If you want there is also the possibility to customize some attributes right from the attributes inspector

It has the following delegate methods that you can use to have more control of the flow of your app.

-(void)CCMPlayNDropViewWillStartDismissAnimationWithDynamics:(CCMPlayNDropView *)view;
-(void)CCMPlayNDropViewDidFinishDismissAnimationWithDynamics:(CCMPlayNDropView *)view;
-(void)CCMPlayNDropViewCanceledDismissWithDynamics:(CCMPlayNDropView *)view;
-(void)CCMPlayNDropView:(CCMPlayNDropView *)view willStartDismissCancelAnimationWithDuration:(CGFloat)duration;
-(void)CCMPlayNDropViewDidFinishDismissCancelAnimation:(CCMPlayNDropView *)view;
-(void)CCMPlayNDropViewManualTraslationDidStart:(CCMPlayNDropView *)view;
It is important to know that even though the view moves out of the screen when flicking it or dropping the view, it is not removed from the superview automatically, so you must remember to handle that when CCMPlayNDropViewDidFinishDismissAnimationWithDynamics: gets called

See the example project for the detail usage.

    CCMPlayNDropView

    02/26/2015

    This is a swarm style dismissable view, you can move it around the screen flick it away, or drop it anywhere to dismiss it。

  • Problems it solves:
-Calculating mutations is too hard and you're just calling reloadData on your collection or table view?
-Users, confused where did that row disappear?
-Rows, jumping out of nowhere?
-Lost scroll position?

Doppelganger is here to help!

Usage:

NSArray *oldDataSource = self.dataSource;
self.dataSource = [self _updatedDataSource];
NSArray *diffs = [WMLArrayDiffUtility diffForCurrentArray:self.dataSource
                                            previousArray:oldDataSource];
[self.tableView wml_applyBatchChanges:diffs
                            inSection:0
                     withRowAnimation:UITableViewRowAnimationRight];

Installation:

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

pod "Doppelganger"

See the example for more detail.

    Doppelganger

    02/26/2015

    Array diffs as collection view wants it。

  • Creating survey/questionnaire:

NSMutableArray *questions = [NSMutableArray array];

NSDictionary *a1 = [NSDictionary dictionaryWithObjectsAndKeys:@"YES",@"text",
                                                            [NSNumber numberWithBool:NO],@"marked", nil];
NSDictionary *a2 = [NSDictionary dictionaryWithObjectsAndKeys:@"NO",@"text",
                                                            [NSNumber numberWithBool:NO],@"marked", nil];
....
....

// single choice question
GWQuestionnaireItem *item = [[GWQuestionnaireItem alloc] initWithQuestion:@"Single choice question ?"
                                                    answers:[NSArray arrayWithObjects:a1,a2, nil]
                                                       type:GWQuestionnaireSingleChoice];
[questions addObject:item];

// multiple choice question
item = [[GWQuestionnaireItem alloc] initWithQuestion:@"Multiple choice question ?"
                                      answers:[NSArray arrayWithObjects:a3,a4,a5, nil]
                                         type:GWQuestionnaireMultipleChoice];
[questions addObject:item];

// "Rate" question
item = [[GWQuestionnaireItem alloc] initWithQuestion:@"Rate it:"
                                      answers:[NSArray arrayWithObjects:a6,a7,a8,a9, nil]
                                         type:GWQuestionnaireRateQuestion];
[questions addObject:item];

// "open" question
item = [[GWQuestionnaireItem alloc] initWithQuestion:@"Type your answer:"
                                      answers:nil
                                         type:GWQuestionnaireOpenQuestion];
[questions addObject:item];

surveyController = [[GWQuestionnaire alloc] initWithItems:questions];
surveyController.view.frame = CGRectMake(0,20,self.view.frame.size.width,self.view.frame.size.height-20);
[self.view addSubview:surveyController.view];

Getting results from it:
// NSLog answers
for(GWQuestionnaireItem *item in surveyController.surveyItems)
{
    NSLog(@"-----------------");
    NSLog(@"%@",item.question);
    NSLog(@"-----------------");
    if(item.type == GWQuestionnaireOpenQuestion)
        NSLog(@"Answer: %@", item.userAnswer);
    else
        for(NSDictionary *dict in item.answers)
        {
            NSLog(@"%d - %@",[[dict objectForKey:@"marked"]boolValue], [dict objectForKey:@"text"]);
        }
}

    GWQuestionnaire

    02/26/2015

    easy questionnaires and surveys solution for iOS。

  • Features:
-Resizable/little space usage - set DKVerticalColorPicker's frame to be whatever makes sense for your application
-Reports color changes to a delegate
-IBDesignable and IBInspectable - set the initial color in IB
-Teeny tiny codebase with no dependencies

    DKVerticalColorPicker

    02/26/2015

    A simple iOS color picker presented as a vertical hue bar.。

  • #import "MozTopAlertView.h"

[MozTopAlertView showWithType:MozAlertTypeInfo text:@"Info" parentView:self.view];

MozTopAlertView *alertView = [MozTopAlertView showWithType:MozAlertTypeSuccess text:@"Success" parentView:self.view];
alertView.dismissBlock = ^(){
    NSLog(@"dismissBlock");
};

[MozTopAlertView showWithType:MozAlertTypeWarning text:@"Warning" doText:@"undo" doBlock:^{

} parentView:self.view];

[MozTopAlertView showWithType:MozAlertTypeError text:@"Error" doText:@"undo" doBlock:^{

} parentView:self.view];

    TopAlertView

    02/26/2015

    An easy to use alert view from top。

  • Usage:
JZDragView *dragView = [JZDragView dragViewWithFrame:self.view.bounds andImages:@[@"a.jpg",@"b.jpg",@"c.jpg",@"d.jpg"]];
    dragView.delegate = self;
    dragView.backgroundColor = [UIColor lightGrayColor];
    [self.view addSubview:dragView];
    self.dragView = dragView;

delegate method:
- (void)dragViewDidEndScrollingAnimation:(JZDragView *)dragView {
    NSLog(@"%s",__func__);
}
- (void)dragViewDidEndDragging:(JZDragView *)dragView withVelocity:(CGPoint)velocity targetContentOffset:(CGFloat)targetContentOffset {
    NSLog(@"%s",__func__);
}
- (void)dragViewDidBeginDragging:(JZDragView *)dragView {
    NSLog(@"%s",__func__);
}
- (void)dragViewDidDragging:(JZDragView *)dragView {
    NSLog(@"%s",__func__);
}

    JZDragView

    02/25/2015

    Drag the image up or Down with parallax。

  • Usage:

#import "ZWIntroductionViewController.h"

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // ... 
// Added Introduction View Controller
NSArray *coverImageNames = @[@"img_index_01txt", @"img_index_02txt", @"img_index_03txt"];
NSArray *backgroundImageNames = @[@"img_index_01bg", @"img_index_02bg", @"img_index_03bg"];
self.introductionView = [[ZWIntroductionViewController alloc] initWithCoverImageNames:coverImageNames backgroundImageNames:backgroundImageNames];

// Example 2 : Custom enter button
//    UIButton *enterButton = [UIButton new];
//    [enterButton setBackgroundImage:[UIImage imageNamed:@"bg_bar"] forState:UIControlStateNormal];
//    self.introductionView = [[ZWIntroductionViewController alloc] initWithCoverImageNames:coverImageNames backgroundImageNames:backgroundImageNames button:enterButton];

[self.window addSubview:self.introductionView.view];

__weak AppDelegate *weakSelf = self;
self.introductionView.didSelectedEnter = ^() {
    [weakSelf.introductionView.view removeFromSuperview];
    weakSelf.introductionView = nil;

    // enter main view , write your code ...

};
}
A working sample iOS Xcode project is available in the Demo directory.

This project includes a podspec for usage with CocoaPods. Simply add
pod 'ZWIntroductionViewController'

    ZWIntroductionViewController

    02/25/2015

    A simple custom app introductions and tutorials.。

  • KSHMosaicCamera is camera capture application,it can Face recognition and with a mosaic effect.

    MosaicCamera

    02/25/2015

    camera can Face recognition and with a mosaic effect。

  • JDFTooltips makes it easy to show tooltip-like popups on iOS (for example, if you want to show instructions/hints to the user the first time they use the app).

Usage

Creating and showing a tooltip is easy. You can create and show a tooltip on its own, like so:

JDFTooltipView *tooltip = [[JDFTooltipView alloc] initWithTargetView:self.label1 hostView:self.view tooltipText:@"This is a Tooltip" arrowDirection:JDFTooltipViewArrowDirectionUp width:200.0f];
[tooltip show];
Or, if you want to show more than one tooltip, it's probably easier to use one of the manager classes, JDFTooltipManager or its subclass JDFSequentialTooltipManager.

JDFTooltipManager allows you to easily show multiple tooltips at once, and by default it will also show a 'backdrop' behind the tooltips (the user can tap anywhere on the backdrop to dismiss the tooltips).

JDFSequentialTooltipManager allows you to easily show your tooltips sequentially; one is shown at a time, with the next one being shown after the previous one is dismissed. JDFSequentialTooltipManager also shows a backdrop by a default - tapping it moves to the next tooltip in the sequence.

These manager classes also provide convenience methods for configuring stuff (background colour, text colour, font etc) on the all of the tooltips they are managing, and convenience methods for creating tooltips.

JDFSequentialTooltipManager example:

    JDFSequentialTooltipManager *tooltipManager = [[JDFSequentialTooltipManager alloc] initWithHostView:self.view];
    [tooltipManager addTooltipWithTargetView:view1 hostView:self.view tooltipText:@"Tooltip 1" arrowDirection:JDFTooltipViewArrowDirectionUp width:200.0f];
    [tooltipManager addTooltipWithTargetView:view2 hostView:self.view tooltipText:@"Tooltip 2" arrowDirection:JDFTooltipViewArrowDirectionUp width:200.0f];
    [tooltipManager addTooltipWithTargetView:view3 hostView:self.view tooltipText:@"Tooltip 3" arrowDirection:JDFTooltipViewArrowDirectionDown width:200.0f];
    [tooltipManager showNextTooltip];

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

If you're not using CocoaPods, simply copy everything from Pod\Classes into your project.

    JDFTooltips

    02/10/2015

    A simple library for showing tooltip-like popups on iOS。

  • The way to impress users on the first app launch.

Created by Raphael Miller and Michael Babiy.

See RMParallax in action: https://www.youtube.com/watch?v=5QRMohq1nBE

If you are looking for a nice way to introduce the features of your app, this control is for you. In addition to paging through images with a nice parallax effect, RMParallax also creates a nice transition for your "description" text. As an added bonus, you can also add motion effect to your pages by simply setting motion:true.

RMParallax is simple to use. All you have to do is create RMParallaxItem:

let item1 = RMParallaxItem(image: UIImage(named: "item1")!, text: "SHARE LIGHTBOXES WITH YOUR TEAM")
let item2 = RMParallaxItem(image: UIImage(named: "item2")!, text: "FOLLOW WORLD CLASS PHOTOGRAPHERS")
let item3 = RMParallaxItem(image: UIImage(named: "item3")!, text: "EXPLORE OUR COLLECTION BY CATEGORY")
Create RMParallax controller with items you created earlier:

let rmParallaxViewController = RMParallax(items: [item1, item2, item3], motion: false)
        rmParallaxViewController.completionHandler = {
            UIView.animateWithDuration(0.4, animations: { () -> Void in
                rmParallaxViewController.view.alpha = 0.0
            })
        }
Add your RMParallax controller to the view controller:

// Adding parallax view controller.
        self.addChildViewController(rmParallaxViewController)
        self.view.addSubview(rmParallaxViewController.view)
        rmParallaxViewController.didMoveToParentViewController(self)
RMParallax uses closures to notify presenting view controller when the user is done paging through. This is a perfect spot to save response, dismiss, or do whatever you like.

Please checkout included sample project.

    RMParallax

    02/10/2015

    The way to impress users on the first app launch.(Swift)。

  • This is a Float View to indicate the direction and quickly scroll up or down to the TableView selected Row.

It basically consists of a custom UILabel with one fixed UIImageView inside it, on the left.

Features

-automatically update label frame and align it on TableView bottom center
-quickly scroll up or down the tableView to the selected row on click
-nice splash animation
-rotation compatible

Installation
Grab the files in View/AnchoredFloatView and put it in your project. The code uses ARC, so make sure to turn that on for the files if you're not already using ARC.

Usage
import the header class on your tableViewController:
#import "AnchoredFloatView.h"
alloc/init the view on viewDidLoad passing tableView and the indexPath of the selectedRow by parameter:

AnchoredFloatView *floatView = [[AnchoredFloatView alloc] initWithTableView:self.tableView andTargetIndexPath:self.targetIndexPath];
[self.view addSubview:floatView];

    AnchoredFloatView

    02/10/2015

    Float View over TableView to indicate selected row direction。

  • All you have to take care of the two protocols NHAutoCompleteTextFieldDataSourceDelegate and NHAutoCompleteTextFieldDataFilterDelegate, first one for preparing and dealing with the datasource and second one is to filter from the data source. Two protocols may help to turn this control into simple drop down and selection control.

Example:

- (void)viewDidLoad
{
[super viewDidLoad];

autoCompleteTextField = [[NHAutoCompleteTextField alloc]
initWithFrame:CGRectMake((kScreenSize.width - controlWidth) / 2, 120,
controlWidth, 18)];
[autoCompleteTextField setDropDownDirection:NHDropDownDirectionDown];
[autoCompleteTextField setDataSourceDelegate:self];
[autoCompleteTextField setDataFilterDelegate:self];
}

#pragma mark - NHAutoComplete DataSource delegate functions

- (NSInteger)autoCompleteTextBox:(NHAutoCompleteTextField
*)autoCompleteTextBox numberOfRowsInSection:(NSInteger)section
{

}

- (UITableViewCell *)autoCompleteTextBox:(NHAutoCompleteTextField
*)autoCompleteTextBox cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

}

#pragma mark - NHAutoComplete Filter data source delegate functions

-(BOOL)shouldFilterDataSource:(NHAutoCompleteTextField
*)autoCompleteTextBox
{

}

-(void)autoCompleteTextBox:(NHAutoCompleteTextField
*)autoCompleteTextBox didFilterSourceUsingText:(NSString *)text
{

}

    NHAutoCompleteTextField

    02/10/2015

    auto complete textfield with custom datasource。

  • Features
-Allows user to pick/capture 2 types of media (Photo and Video).
-Picking options: Camera, Camera Roll, Photo Library and Last photo/video taken.
-Delegate protocol available for more control.
-Fully customizable with UIImagePickerController properties (Camera Overlay, Camera Device, Camera View Transform, allowsEditing, etc).
-Uses Assets Library Framework, provides original ALAsset. (Easy to deal with).
Supports Portrait & Landscape Modes.
Native iOS UI (It uses UIImagePickerController under the hood).
Easy to apply in your project.

    CRMediaPickerController

    02/10/2015

    An easy-to-use UIImagePickerController replacement for picking Images and Videos.。

  • Loading Indicator for UIImageView written in Swift.

o-Simple to use
o-Handles network calls and background image decoding.
o-Background decoding of Images
o-Handles Error states and retrying download.
x-Handles offline caching. Coming soon.

Cocoapod

pod 'LoadingImageView'

USAGE
As simple as

import LoadingImageView

let imageView = LoadingImageView()
view.addSubview(imageView)
let imageURL = NSURL(string: "https://catfishes.files.wordpress.com/2013/03/cat-breaded.jpg")
imageView.downloadImage(imageURL, placeholder: nil)
API

var state: LoadingImageState 
weak var delegate: LoadingImageViewDelegate?
var inset: Float
var lineWidth: Float
var lineColor: UIColor    
var reloadImage: UIImage 

func downloadImage(URL: NSURL, placeholder:UIImage?)->NSURLSessionDownloadTask
Delegate and State

enum LoadingImageState {
  case Idle
  case Downloading(NSURLSessionDownloadTask)
  case Errored(NSURLSessionDownloadTask, NSError)
}

protocol LoadingImageViewDelegate : NSObjectProtocol {
  func loadingImageViewStateChanged(imageView: LoadingImageView, state: LoadingImageState)
  func shouldAttemptRetry(imageView: LoadingImageView)->Bool
  func imageForReloadState(imageView: LoadingImageView)->UIImage
}

    LoadingImageView

    02/09/2015

    Loading Indicator for UIImageView, written in Swift.。

  • Show emitter animation while playing music with AVAudioPlayer.You can see the rhythm from the animation

See example project for the easy Usage.

    EmitterAnimation-With-Music

    02/06/2015

    Show emitter animation while playing music with AVAudioPlayer。

  • FeSpinner work on any version iOS and compatible with ARC or non-ARC. But your project should include some Apple's framework.
-Foundation.framework
-UIKit.framework
-CoreGraphics.framework
-QuartzCore.framework

ADD ROCKET LOADER TO YOUR PROJECT

Just simply copy file .h and .m in each type loader you like.

HOW TO USE

FeSpinner is very similar MBProgessHUB.

FeSpinner have some helpful method.

-(id) initWithView:(UIView *) view blur:(BOOL) blur backgroundColors:(NSArray *) arrColor;

-(void) show;

-(void) showWhileExecutingBlock:(dispatch_block_t) block;

-(void) showWhileExecutingBlock:(dispatch_block_t)block completion:(dispatch_block_t) completion;

-(void) showWhileExecutingSelector:(SEL) selector onTarget:(id) target withObject:(id) object;

-(void) showWhileExecutingSelector:(SEL)selector onTarget:(id)target withObject:(id)object completion:(dispatch_block_t) completion;

-(void) dismiss;

    FeSpinner

    02/06/2015

    Rocket Loader Collection for iOS app。

  • Usage
To run the example project, clone the repo, and run pod install from the Example directory first.

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

    BTLabel

    02/06/2015

    UILabel subclass with vertical text alignment, insets and height calculation.。

  • Content Mode Animatable Image View, change image view's content mode with your animation!

Installation

Cocoapods

pod 'VICMAImageView', '~> 1.0'

Usage

Use VICMAImageView like a UIImageView

- (void)viewDidLoad {
    [super viewDidLoad];
    UIImage *image = [UIImage imageNamed:@"1.jpg"];
    VICMAImageView *imageView = [[VICMAImageView alloc] initWithImage:image];
    imageView.frame = CGRectMake(0, 0, 100, 100);
    [self.view addSubview:imageView];
}
Animate contentMode in animation block

[UIView animateWithDuration:0.3
                     animations:^{
                         imageView.contentMode = UIViewContentModeScaleAspectFill;
                     }];
See the example project for detail.

    VICMAImageView

    02/06/2015

    Content Mode Animatable Image View, change image view's content mode with your animation!。

Popular Code

More >