Picker for selecting a time span using native UIPickerView. It's customizable using UIAppearance, localizable, brings it's own delegate for efficient and fast integration in exisiting projects and uses ARC.
MSCTimeSpanPicker *timeSpanPicker = [[MSCTimeSpanPicker alloc] init]; timeSpanPicker.delegate = self; // Set the frame so that the MSCTimeSpanPicker appears on the bottom. CGRect timeSpanPickerFrame = timeSpanPicker.frame; timeSpanPickerFrame.origin.y = self.rootViewController.view.frame.size.height - timeSpanPickerFrame.size.height; timeSpanPicker.frame = timeSpanPickerFrame; [self.view addSubview:timeSpanPicker];
Add to your project
- Add MSCTimeSpanPicker.xcodeproj as subproject.
- Add MSCTimeSpanPicker's root folder to your project's header search paths.
- Add MSCTimeSpanPicker to your target's dependencies (Target >> Build Phases >> Target Dependencies).
- Add MSCTimeSpanPicker to your target's linked frameworks (Target >> Summary >> Linked Frameworks and Libraries).
- Add MSCTimeSpanPickerResources to your target's dependencies (Target >> Build Phases >> Target Dependencies).
- Add MSCTimeSpanPickerResources.bundle to your target's copied bundle resources (Drag the bundle from MSCTimeSpanPicker.xcodeproj/Products/ and drop it onto 'Target >> Build Phases >> Copy Bundle Resources').
- Import "MSCTimeSpanPicker.h" either in Prefix.pch or seperatly in any file you use it.
"to" and/or "from" got changed by rotating one of the wheels.
- (void)timeSpanPicker:(MSCTimeSpanPicker *)timeSpanPicker selectedFrom:(NSDate *)from andTo:(NSDate *)to;
MSCTimeSpanPicker got dismissed by pressing the "Cancel" button
- (void)timeSpanPickerCancelled:(MSCTimeSpanPicker *)timeSpanPicker;
MSCTimeSpanPicker got dismissed by pressing the "Save" button
- (void)timeSpanPickerSaved:(MSCTimeSpanPicker *)timeSpanPicker;
Customizing using UIAppearance
MSCTimeSpanPicker only uses UIToolbar, UIBarButtonItem and UIPickerView so it's fully compatible to UIAppearance, e.g.:
[[UIToolbar appearanceWhenContainedIn:[MSCTimeSpanPicker class], nil] setBarStyle:UIBarStyleBlack];
MSCTimeSpanPicker is localizable using Localizable.strings contained in MSCTimeSpanPickerResources.bundle.
MSCTimeSpanPicker is available under the MIT license. See the LICENSE file for more info. For usage without attribution contact Manfred Scheiner.