-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from Club15CC/15cc-fork
Updated source and project for ARC
- Loading branch information
Showing
22 changed files
with
470 additions
and
346 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// ActionSheetPicker.h | ||
// ActionSheetPicker | ||
// | ||
// Created by on 13/03/2012. | ||
// Copyright (c) 2012 Club 15CC. All rights reserved. | ||
// | ||
#import <UIKit/UIKit.h> | ||
#import "AbstractActionSheetPicker.h" | ||
#import "ActionSheetCustomPickerDelegate.h" | ||
|
||
@interface ActionSheetCustomPicker : AbstractActionSheetPicker | ||
{ | ||
} | ||
|
||
///////////////////////////////////////////////////////////////////////// | ||
#pragma mark - Properties | ||
///////////////////////////////////////////////////////////////////////// | ||
@property (nonatomic, strong) id<ActionSheetCustomPickerDelegate> delegate; | ||
|
||
|
||
///////////////////////////////////////////////////////////////////////// | ||
#pragma mark - Init Methods | ||
///////////////////////////////////////////////////////////////////////// | ||
|
||
/** Designated init */ | ||
- (id)initWithTitle:(NSString *)title delegate:(id<ActionSheetCustomPickerDelegate>)delegate showCancelButton:(BOOL)showCancelButton origin:(id)origin; | ||
|
||
/** Convenience class method for creating an launched */ | ||
+ (id)showPickerWithTitle:(NSString *)title delegate:(id<ActionSheetCustomPickerDelegate>)delegate showCancelButton:(BOOL)showCancelButton origin:(id)origin; | ||
|
||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// | ||
// ActionSheetPicker.m | ||
// ActionSheetPicker | ||
// | ||
// Created by on 13/03/2012. | ||
// Copyright (c) 2012 Club 15CC. All rights reserved. | ||
// | ||
|
||
#import "ActionSheetCustomPicker.h" | ||
|
||
@implementation ActionSheetCustomPicker | ||
|
||
@synthesize delegate = _delegate; | ||
|
||
|
||
///////////////////////////////////////////////////////////////////////// | ||
#pragma mark - Init | ||
///////////////////////////////////////////////////////////////////////// | ||
|
||
- (id)initWithTitle:(NSString *)title delegate:(id<ActionSheetCustomPickerDelegate>)delegate showCancelButton:(BOOL)showCancelButton origin:(id)origin | ||
{ | ||
if (self = [self initWithTarget:nil successAction:nil cancelAction:nil origin:origin]) {; | ||
|
||
self.title = title; | ||
self.hideCancel = !showCancelButton; | ||
_delegate = delegate; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
///////////////////////////////////////////////////////////////////////// | ||
|
||
+ (id)showPickerWithTitle:(NSString *)title delegate:(id<ActionSheetCustomPickerDelegate>)delegate showCancelButton:(BOOL)showCancelButton origin:(id)origin | ||
{ | ||
ActionSheetCustomPicker *picker = [[ActionSheetCustomPicker alloc] initWithTitle:title delegate:delegate showCancelButton:showCancelButton origin:origin]; | ||
[picker showActionSheetPicker]; | ||
return picker; | ||
} | ||
|
||
///////////////////////////////////////////////////////////////////////// | ||
#pragma mark - AbstractActionSheetPicker fulfilment | ||
///////////////////////////////////////////////////////////////////////// | ||
|
||
- (UIView *)configuredPickerView { | ||
CGRect pickerFrame = CGRectMake(0, 40, self.viewSize.width, 216); | ||
UIPickerView *pv = [[UIPickerView alloc] initWithFrame:pickerFrame]; | ||
|
||
// Default to our delegate being the picker's delegate and datasource | ||
pv.delegate = _delegate; | ||
pv.dataSource = _delegate; | ||
pv.showsSelectionIndicator = YES; | ||
|
||
// Allow the delegate to override and set additional configs | ||
if ([_delegate respondsToSelector:@selector(configurePickerView:)]) { | ||
[_delegate configurePickerView:pv]; | ||
} | ||
self.pickerView = pv; | ||
return pv; | ||
} | ||
|
||
///////////////////////////////////////////////////////////////////////// | ||
|
||
- (void)notifyTarget:(id)target didSucceedWithAction:(SEL)successAction origin:(id)origin | ||
{ | ||
// Ignore parent args and just notify the delegate | ||
if ([_delegate respondsToSelector:@selector(actionSheetPickerDidSucceed:origin:)]) { | ||
[_delegate actionSheetPickerDidSucceed:self origin:origin]; | ||
} | ||
} | ||
|
||
///////////////////////////////////////////////////////////////////////// | ||
|
||
- (void)notifyTarget:(id)target didCancelWithAction:(SEL)cancelAction origin:(id)origin | ||
{ | ||
// Ignore parent args and just notify the delegate | ||
if ([_delegate respondsToSelector:@selector(actionSheetPickerDidCancel:origin:)]) { | ||
[_delegate actionSheetPickerDidCancel:self origin:origin]; | ||
} | ||
} | ||
|
||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// ActionSheetPickerDelegate.h | ||
// ActionSheetPicker | ||
// | ||
// Created by on 13/03/2012. | ||
// Copyright (c) 2012 Club 15CC. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import "AbstractActionSheetPicker.h" | ||
|
||
@protocol ActionSheetCustomPickerDelegate <UIPickerViewDelegate, UIPickerViewDataSource> | ||
|
||
@optional | ||
|
||
/** | ||
Allow the delegate to override default settings for the picker | ||
Allows for instance, ability to set separate delegates and data sources as well as GUI settings on the UIPickerView | ||
If not defined and explicily overridden then this class will be the delegate and dataSource. | ||
*/ | ||
- (void)configurePickerView:(UIPickerView *)pickerView; | ||
|
||
/** | ||
Success callback | ||
\param actionSheetPicker .pickerView property accesses the picker. Requires a cast to UIView subclass for the picker | ||
\param origin The entity which launched the ActionSheetPicker | ||
*/ | ||
- (void)actionSheetPickerDidSucceed:(AbstractActionSheetPicker *)actionSheetPicker origin:(id)origin; | ||
|
||
/** Cancel callback. See actionSheetPickerDidSuccess:origin: */ | ||
- (void)actionSheetPickerDidCancel:(AbstractActionSheetPicker *)actionSheetPicker origin:(id)origin; | ||
|
||
|
||
@required | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.