Skip to content

Commit

Permalink
fix compiler warrnings
Browse files Browse the repository at this point in the history
  • Loading branch information
skywinder committed Aug 1, 2014
1 parent 5c5ea72 commit f85f7a5
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 36 deletions.
4 changes: 0 additions & 4 deletions Example/Classes/ActionSheetPickerAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,9 @@


#import "ActionSheetPickerAppDelegate.h"
#import "ActionSheetPickerViewController.h"

@implementation ActionSheetPickerAppDelegate

@synthesize window;


#pragma mark -
#pragma mark Application lifecycle

Expand Down
12 changes: 5 additions & 7 deletions Example/Classes/ActionSheetPickerCustomPickerDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

@implementation ActionSheetPickerCustomPickerDelegate

@synthesize selectedKey, selectedScale;

- (id)init
- (id)init
{
if (self = [super init]) {
notesToDisplayForKey = [NSArray arrayWithObjects: @"C", @"Db", @"D", @"Eb", @"E", @"F", @"Gb", @"G", @"Ab", @"A", @"Bb", @"B", nil];
Expand Down Expand Up @@ -85,8 +83,8 @@ - (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)co
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
switch (component) {
case 0: return [notesToDisplayForKey objectAtIndex:row];
case 1: return [scaleNames objectAtIndex:row];
case 0: return [notesToDisplayForKey objectAtIndex:(NSUInteger) row];
case 1: return [scaleNames objectAtIndex:(NSUInteger) row];
default:break;
}
return nil;
Expand All @@ -99,11 +97,11 @@ - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComp
NSLog(@"Row %i selected in component %i", row, component);
switch (component) {
case 0:
selectedKey = [notesToDisplayForKey objectAtIndex:row];
self.selectedKey = [notesToDisplayForKey objectAtIndex:(NSUInteger) row];
return;

case 1:
selectedScale = [scaleNames objectAtIndex:row];
self.selectedScale = [scaleNames objectAtIndex:(NSUInteger) row];
return;
default:break;
}
Expand Down
3 changes: 1 addition & 2 deletions Example/Classes/ActionSheetPickerViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
- (IBAction)selectAnAnimal:(id)sender;
- (IBAction)selectADate:(id)sender;
- (IBAction)selectATime:(id)sender;
- (IBAction)animalButtonTapped:(UIBarButtonItem *)sender;
- (IBAction)dateButtonTapped:(UIBarButtonItem *)sender;

- (IBAction)selectAMeasurement:(id)sender;
- (IBAction)selectAMusicalScale:(UIControl *)sender;
- (IBAction)selectLocation:(UITextField *)sender;
Expand Down
11 changes: 1 addition & 10 deletions Example/Classes/ActionSheetPickerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@


#import "ActionSheetPickerViewController.h"
#import "ActionSheetPicker.h"
#import "NSDate+TCUtils.h"
#import "ActionSheetPickerCustomPickerDelegate.h"
#import "TestTableViewController.h"
Expand Down Expand Up @@ -124,14 +123,6 @@ -(IBAction)selectATime:(id)sender {
}


- (IBAction)animalButtonTapped:(UIBarButtonItem *)sender {
[self selectAnAnimal:sender];
}

- (IBAction)dateButtonTapped:(UIBarButtonItem *)sender {
[self selectADate:sender];
}

- (IBAction)selectAMeasurement:(UIControl *)sender {
[ActionSheetDistancePicker showPickerWithTitle:@"Select Length" bigUnitString:@"m" bigUnitMax:330 selectedBigUnit:self.selectedBigUnit smallUnitString:@"cm" smallUnitMax:99 selectedSmallUnit:self.selectedSmallUnit target:self action:@selector(measurementWasSelectedWithBigUnit:smallUnit:element:) origin:sender];
}
Expand Down Expand Up @@ -165,7 +156,7 @@ - (void)animalWasSelected:(NSNumber *)selectedIndex element:(id)element {
self.selectedIndex = [selectedIndex intValue];

//may have originated from textField or barButtonItem, use an IBOutlet instead of element
self.animalTextField.text = [self.animals objectAtIndex:self.selectedIndex];
self.animalTextField.text = [self.animals objectAtIndex:(NSUInteger) self.selectedIndex];
}

- (void)dateWasSelected:(NSDate *)selectedDate element:(id)element {
Expand Down
1 change: 0 additions & 1 deletion Example/Classes/TestTableViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@


@interface TestTableViewController : UITableViewController
@property(nonatomic, strong) NSArray *animals;
@end
2 changes: 1 addition & 1 deletion Pickers/AbstractActionSheetPicker.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
- (void)notifyTarget:(id)target didCancelWithAction:(SEL)cancelAction origin:(id)origin;

// For subclasses. This returns a configured picker view. Subclasses should autorelease.
- (UIPickerView *)configuredPickerView;
- (UIView *)configuredPickerView;

// Adds custom buttons to the left of the UIToolbar that select specified values
- (void)addCustomButtonWithTitle:(NSString *)title value:(id)value;
Expand Down
2 changes: 1 addition & 1 deletion Pickers/AbstractActionSheetPicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ - (IBAction)customButtonPressed:(id)sender
NSAssert((index >= 0 && index < self.customButtons.count), @"Bad custom button tag: %d, custom button count: %d", index, self.customButtons.count);
NSAssert([self.pickerView respondsToSelector:@
selector(selectRow:inComponent:animated:)], @"customButtonPressed not overridden, cannot interact with subclassed pickerView");
NSDictionary *buttonDetails = [self.customButtons objectAtIndex:index];
NSDictionary *buttonDetails = [self.customButtons objectAtIndex:(NSUInteger) index];
NSAssert(buttonDetails != NULL, @"Custom button dictionary is invalid");
NSInteger buttonValue = [[buttonDetails objectForKey:@"buttonValue"] intValue];
UIPickerView *picker = (UIPickerView *) self.pickerView;
Expand Down
6 changes: 3 additions & 3 deletions Pickers/ActionSheetCustomPicker.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@
/////////////////////////////////////////////////////////////////////////
#pragma mark - Properties
/////////////////////////////////////////////////////////////////////////
@property (nonatomic, strong) id<ActionSheetCustomPickerDelegate> delegate;
@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;
- (id)initWithTitle:(NSString *)title delegate:(id <ActionSheetCustomPickerDelegate>)delegate showCancelButton:(BOOL)showCancelButton origin:(id)origin;

- (id)initWithTitle:(NSString *)title delegate:(id <ActionSheetCustomPickerDelegate>)delegate showCancelButton:(BOOL)showCancelButton origin:(id)origin initialSelections:(NSArray *)initialSelections;

/** Convenience class method for creating an launched */
+ (id)showPickerWithTitle:(NSString *)title delegate:(id<ActionSheetCustomPickerDelegate>)delegate showCancelButton:(BOOL)showCancelButton origin:(id)origin;
+ (id)showPickerWithTitle:(NSString *)title delegate:(id <ActionSheetCustomPickerDelegate>)delegate showCancelButton:(BOOL)showCancelButton origin:(id)origin;

+ (id)showPickerWithTitle:(NSString *)title delegate:(id <ActionSheetCustomPickerDelegate>)delegate showCancelButton:(BOOL)showCancelButton origin:(id)origin initialSelections:(NSArray *)initialSelections;

Expand Down
2 changes: 1 addition & 1 deletion Pickers/ActionSheetDatePicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ - (void)customButtonPressed:(id)sender {
NSInteger index = button.tag;
NSAssert((index >= 0 && index < self.customButtons.count), @"Bad custom button tag: %d, custom button count: %d", index, self.customButtons.count);
NSAssert([self.pickerView respondsToSelector:@selector(setDate:animated:)], @"Bad pickerView for ActionSheetDatePicker, doesn't respond to setDate:animated:");
NSDictionary *buttonDetails = [self.customButtons objectAtIndex:index];
NSDictionary *buttonDetails = [self.customButtons objectAtIndex:(NSUInteger) index];
NSDate *itemValue = [buttonDetails objectForKey:@"buttonValue"];
UIDatePicker *picker = (UIDatePicker *)self.pickerView;
[picker setDate:itemValue animated:YES];
Expand Down
5 changes: 3 additions & 2 deletions Pickers/ActionSheetDistancePicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ - (UIView *)configuredPickerView {
picker.delegate = self;
picker.dataSource = self;
picker.showsSelectionIndicator = YES;
[picker addLabel:self.bigUnitString forComponent:(self.bigUnitDigits - 1) forLongestString:nil];
[picker addLabel:self.smallUnitString forComponent:(self.bigUnitDigits + self.smallUnitDigits - 1) forLongestString:nil];
[picker addLabel:self.bigUnitString forComponent:(NSUInteger) (self.bigUnitDigits - 1) forLongestString:nil];
[picker addLabel:self.smallUnitString forComponent:(NSUInteger) (self.bigUnitDigits + self.smallUnitDigits - 1)
forLongestString:nil];

NSInteger unitSubtract = 0;
NSInteger currentDigit = 0;
Expand Down
4 changes: 2 additions & 2 deletions Pickers/ActionSheetStringPicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ - (UIView *)configuredPickerView {

- (void)notifyTarget:(id)target didSucceedWithAction:(SEL)successAction origin:(id)origin {
if (self.onActionSheetDone) {
id selectedObject = (self.data.count > 0) ? [self.data objectAtIndex:self.selectedIndex] : nil;
id selectedObject = (self.data.count > 0) ? [self.data objectAtIndex:(NSUInteger) self.selectedIndex] : nil;
_onActionSheetDone(self, self.selectedIndex, selectedObject);
return;
}
Expand Down Expand Up @@ -136,7 +136,7 @@ - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSIn
}

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
id obj = [self.data objectAtIndex:row];
id obj = [self.data objectAtIndex:(NSUInteger) row];

// return the object if it is already a NSString,
// otherwise, return the description, just like the toString() method in Java
Expand Down
4 changes: 2 additions & 2 deletions Pickers/DistancePickerView.m
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ - (void)didMoveToWindow
if ( NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1)
{
[self insertSubview:label
aboveSubview:[[self.subviews[0] subviews] objectAtIndex:component]];
aboveSubview:[[self.subviews[0] subviews] objectAtIndex:(NSUInteger) component]];
}
else
{
[self insertSubview:label aboveSubview:[self.subviews objectAtIndex:5 * (component + 1)]];
[self insertSubview:label aboveSubview:[self.subviews objectAtIndex:(NSUInteger) (5 * (component + 1))]];
}

}
Expand Down

0 comments on commit f85f7a5

Please sign in to comment.