• Stars
    star
    620
  • Rank 72,387 (Top 2 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 11 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An iOS day picker to allow users to select date

MZDayPicker

An iOS day picker to allow users to select date

How To Use

Just add MZDayPicker library files to your project and setup MZDayPicker in storyboard and IBOutlet to your controller to conform to the MZDayPicker delegate to recieve callbacks

@property (weak, nonatomic) IBOutlet MZDayPicker *dayPicker;

You can setup picker using current month:

- (void)viewDidLoad
{
    [super viewDidLoad];

	self.dayPicker.month = 9;
    self.dayPicker.year = 2013;

    self.dayPicker.delegate = self;
    
    self.dayPicker.dayNameLabelFontSize = 7.0f;
    self.dayPicker.dayLabelFontSize = 15.0f;
    [self.dayPicker setActiveDaysFrom:1 toDay:30];

    [self.dayPicker setCurrentDay:15 animated:NO];
}

You can also setup start and end date range:

- (void)viewDidLoad
{
    [super viewDidLoad];

    ...

    [self.dayPicker setStartDate:[NSDate dateFromDay:28 month:9 year:2013] endDate:[NSDate dateFromDay:5 month:10 year:2013]];
    
    [self.dayPicker setCurrentDate:[NSDate dateFromDay:3 month:10 year:2013] animated:NO];
}

Implement the optional delegate method to be notified when a new day item is selected

- (void)dayPicker:(MZDayPicker *)dayPicker willSelectDay:(MZDay *)day
{
    NSLog(@"Will select day %@",day.day);
}

- (void)dayPicker:(MZDayPicker *)dayPicker didSelectDay:(MZDay *)day
{
    NSLog(@"Did select day %@",day.day);
    
    [self.tableData addObject:day];
    [self.tableView reloadData];
}

Delegates

@protocol MZDayPickerDataSource <NSObject>
@optional
- (NSString *)dayPicker:(MZDayPicker *)dayPicker titleForCellDayLabelInDay:(MZDay *)day;
- (NSString *)dayPicker:(MZDayPicker *)dayPicker titleForCellDayNameLabelInDay:(MZDay *)day;

@end

@protocol MZDayPickerDelegate <NSObject>
@optional
- (void)dayPicker:(MZDayPicker *)dayPicker scrollViewDidScroll:(UIScrollView *)scrollView;
- (void)dayPicker:(MZDayPicker *)dayPicker scrollViewDidEndDecelerating:(UIScrollView *)scrollView;
- (void)dayPicker:(MZDayPicker *)dayPicker scrollViewDidEndDragging:(UIScrollView *)scrollView;

- (void)dayPicker:(MZDayPicker *)dayPicker willSelectDay:(MZDay *)day;
- (void)dayPicker:(MZDayPicker *)dayPicker didSelectDay:(MZDay *)day;

@end

Appearance configuration

/* 
 * Font colors (optional)
 */
@property (nonatomic, strong) UIColor *activeDayColor;
@property (nonatomic, strong) UIColor *activeDayNameColor;
@property (nonatomic, strong) UIColor *inactiveDayColor;

/*
 * Picker background color (optional)
 */
@property (nonatomic, strong) UIColor *backgroundPickerColor;

/*
 * Property for cell footer color (optional)
 */
@property (nonatomic, strong) UIColor *bottomBorderColor;

/* Day number and name font size (optional) */
@property (nonatomic, assign) CGFloat dayLabelFontSize;
@property (nonatomic, assign) CGFloat dayNameLabelFontSize;

/* Day number zoom scale (optional) */
@property (nonatomic, assign) CGFloat dayLabelZoomScale;

@property (nonatomic, readonly) CGSize dayCellSize;
@property (nonatomic, readonly) CGFloat dayCellFooterHeight;

Requirements

MZDayPicker requires either iOS 5.x and above.

Storyboard

MZDayPicker supports storyboard.

ARC

MZDayPicker uses ARC.

Contact

Michal Zaborowski

Bitdeli Badge

More Repositories

1

MZFormSheetController

MZFormSheetController provides an alternative to the native iOS UIModalPresentationFormSheet, adding support for iPhone and additional opportunities to setup controller size and feel form sheet.
Objective-C
2,534
star
2

MZFormSheetPresentationController

MZFormSheetPresentationController provides an alternative to the native iOS UIModalPresentationFormSheet, adding support for iPhone and additional opportunities to setup UIPresentationController size and feel form sheet.
Objective-C
974
star
3

INSPullToRefresh

A simple to use very generic pull-to-refresh and infinite scrolling functionalities as a UIScrollView category.
Objective-C
814
star
4

WCAlertView

WCAlertView is deliverd from UIAlertView. It's support customization and blocks.
Objective-C
617
star
5

INSElectronicProgramGuideLayout

UICollectionViewLayout for displaying electronic program guide.
Objective-C
487
star
6

INSPhotoGallery

INSPhotoGallery is a modern looking photo gallery written in Swift for iOS.
Swift
396
star
7

MZBookshelfCollectionViewLayout

Bookshelf like iBooks layout for UICollectionView.
Objective-C
122
star
8

INSOperationsKit

Objective-C adaptation of the sample code provided in the Advanced NSOperations session of WWDC 2015
Objective-C
112
star
9

MZAppearance

UIAppearance proxy for custom objects
Objective-C
106
star
10

MZSelectableLabel

A simple to use drop in replacement for UILabel for iOS 7 that provides automatic detection of colors.
Objective-C
102
star
11

UIAlertController-MZStyle

Category for UIAlertController customization
Objective-C
94
star
12

MZFayeClient

Faye Client for iOS. Supports subscription blocks.
Objective-C
84
star
13

INSPersistentContainer

Open Source, 100% API compatible replacement of NSPersistentContainer for iOS8+
Objective-C
65
star
14

SpotifyImporter

Spotify library importer into Apple Music
Objective-C
55
star
15

WCBeforeAfter

Objective-C BeforeAfter
Objective-C
52
star
16

INSNibLoading

A UIView/NSView category and a subclass for loading custom view from UINib (xib) files
Objective-C
26
star
17

AccessibilityIdentificable

Identifiers for UI testing: a reflection based approach
Swift
22
star
18

source-tree-custom-commands

A collection of SourceTree CustomActions.
Shell
20
star
19

RWMAmazonProductAdvertisingManager

AFNetworking Client for Amazon Product Advertising API
Objective-C
13
star
20

ContextWatcher

Example which shows how to observe changes on single NSManagedObject instance
Swift
13
star
21

RWMVimeoClient

AFNetworking Client for Vimeo Advanced API
Objective-C
12
star
22

CCTouchableSprite

Touchable CCSprite for cocos2d framework with Objective-C Blocks
Objective-C
7
star
23

xcode-themes

My Xcode themes
1
star