diff --git a/TimelineView/TimelineView+Gestures.m b/TimelineView/TimelineView+Gestures.m index 932c915..6bf9585 100644 --- a/TimelineView/TimelineView+Gestures.m +++ b/TimelineView/TimelineView+Gestures.m @@ -100,8 +100,8 @@ - (BOOL)startSelectingCell:(TimelineViewCell *)cell return NO; } - if([delegate respondsToSelector:@selector(timelineView:shouldHighlightItemAtIndex:)] && - [delegate timelineView:self shouldHighlightItemAtIndex:cell.index] == NO) + if([timelineViewDelegate respondsToSelector:@selector(timelineView:shouldHighlightItemAtIndex:)] && + [timelineViewDelegate timelineView:self shouldHighlightItemAtIndex:cell.index] == NO) { return NO; } @@ -109,8 +109,8 @@ - (BOOL)startSelectingCell:(TimelineViewCell *)cell cell.highlighted = YES; [self bringSubviewToFront:cell]; - if([delegate respondsToSelector:@selector(timelineView:didHighlightItemAtIndex:)]) { - [delegate timelineView:self didHighlightItemAtIndex:cell.index]; + if([timelineViewDelegate respondsToSelector:@selector(timelineView:didHighlightItemAtIndex:)]) { + [timelineViewDelegate timelineView:self didHighlightItemAtIndex:cell.index]; } if(allowsMultipleSelection == NO) { @@ -128,8 +128,8 @@ - (void)cancelSelectingCell:(TimelineViewCell *)cell { cell.highlighted = NO; - if([delegate respondsToSelector:@selector(timelineView:didUnhighlightItemAtIndex:)]) { - [delegate timelineView:self didUnhighlightItemAtIndex:cell.index]; + if([timelineViewDelegate respondsToSelector:@selector(timelineView:didUnhighlightItemAtIndex:)]) { + [timelineViewDelegate timelineView:self didUnhighlightItemAtIndex:cell.index]; } } @@ -139,8 +139,8 @@ - (void)finishSelectingCell:(TimelineViewCell *)cell cell.highlighted = NO; - if([delegate respondsToSelector:@selector(timelineView:didUnhighlightItemAtIndex:)]) { - [delegate timelineView:self didUnhighlightItemAtIndex:cellIndex]; + if([timelineViewDelegate respondsToSelector:@selector(timelineView:didUnhighlightItemAtIndex:)]) { + [timelineViewDelegate timelineView:self didUnhighlightItemAtIndex:cellIndex]; } if(! allowsMultipleSelection) { @@ -148,29 +148,29 @@ - (void)finishSelectingCell:(TimelineViewCell *)cell } if(! allowsMultipleSelection || ! [selectedIndexes containsIndex:cellIndex]) { - if([delegate respondsToSelector:@selector(timelineView:willSelectItemAtIndex:)]) { - [delegate timelineView:self willSelectItemAtIndex:cellIndex]; + if([timelineViewDelegate respondsToSelector:@selector(timelineView:willSelectItemAtIndex:)]) { + [timelineViewDelegate timelineView:self willSelectItemAtIndex:cellIndex]; } cell.selected = YES; [selectedIndexes addIndex:cellIndex]; - if([delegate respondsToSelector:@selector(timelineView:didSelectItemAtIndex:)]) { - [delegate timelineView:self didSelectItemAtIndex:cellIndex]; + if([timelineViewDelegate respondsToSelector:@selector(timelineView:didSelectItemAtIndex:)]) { + [timelineViewDelegate timelineView:self didSelectItemAtIndex:cellIndex]; } } - else if([delegate respondsToSelector:@selector(timelineView:shouldDeselectItemAtIndex:)] == NO || - [delegate timelineView:self shouldDeselectItemAtIndex:cellIndex] == YES) + else if([timelineViewDelegate respondsToSelector:@selector(timelineView:shouldDeselectItemAtIndex:)] == NO || + [timelineViewDelegate timelineView:self shouldDeselectItemAtIndex:cellIndex] == YES) { - if([delegate respondsToSelector:@selector(timelineView:willDeselectItemAtIndex:)]) { - [delegate timelineView:self willDeselectItemAtIndex:cellIndex]; + if([timelineViewDelegate respondsToSelector:@selector(timelineView:willDeselectItemAtIndex:)]) { + [timelineViewDelegate timelineView:self willDeselectItemAtIndex:cellIndex]; } cell.selected = NO; [selectedIndexes removeIndex:cellIndex]; - if([delegate respondsToSelector:@selector(timelineView:didDeselectItemAtIndex:)]) { - [delegate timelineView:self didDeselectItemAtIndex:cellIndex]; + if([timelineViewDelegate respondsToSelector:@selector(timelineView:didDeselectItemAtIndex:)]) { + [timelineViewDelegate timelineView:self didDeselectItemAtIndex:cellIndex]; } } } diff --git a/TimelineView/TimelineView+Mutation.m b/TimelineView/TimelineView+Mutation.m index b8aa989..5dc53c4 100644 --- a/TimelineView/TimelineView+Mutation.m +++ b/TimelineView/TimelineView+Mutation.m @@ -200,7 +200,7 @@ - (void)updateCells:(void (^)(void))updates completion:(void (^)(BOOL finished)) if(cellCount != expectedCount) { @throw [NSException exceptionWithName:NSInternalInconsistencyException - reason:[NSString stringWithFormat:@"Invalid update: invalid number of items. The number of items after the update (%d) must be equal to the number of items before the update (%d), plus or minus the number of items inserted or deleted (%d inserted, %d deleted).", cellCount, pastCount, insertCount, deleteCount] + reason:[NSString stringWithFormat:@"Invalid update: invalid number of items. The number of items after the update (%ld) must be equal to the number of items before the update (%ld), plus or minus the number of items inserted or deleted (%ld inserted, %ld deleted).", (long)cellCount, (long)pastCount, (long)insertCount, (long)deleteCount] userInfo:nil]; } diff --git a/TimelineView/TimelineView+Tiling.m b/TimelineView/TimelineView+Tiling.m index 0c493ad..75e25d8 100644 --- a/TimelineView/TimelineView+Tiling.m +++ b/TimelineView/TimelineView+Tiling.m @@ -60,8 +60,8 @@ - (void)tileCells if(cellIndex < startIndex || cellIndex > endIndex) { [cell removeFromSuperview]; [cacheFrameLookup removeObjectForKey:@(cellIndex)]; - if([delegate respondsToSelector:@selector(timelineView:didEndDisplayingCell:atIndex:)]) { - [delegate timelineView:self didEndDisplayingCell:cell atIndex:cellIndex]; + if([timelineViewDelegate respondsToSelector:@selector(timelineView:didEndDisplayingCell:atIndex:)]) { + [timelineViewDelegate timelineView:self didEndDisplayingCell:cell atIndex:cellIndex]; } [recycledCells addObject:cell]; } @@ -89,8 +89,8 @@ - (void)tileCells } if(cell != nil) { - if([delegate respondsToSelector:@selector(timelineView:willDisplayCell:atIndex:)]) { - [delegate timelineView:self willDisplayCell:cell atIndex:index]; + if([timelineViewDelegate respondsToSelector:@selector(timelineView:willDisplayCell:atIndex:)]) { + [timelineViewDelegate timelineView:self willDisplayCell:cell atIndex:index]; } [visibleCells addObject:cell]; [self insertSubview:cell atIndex:0]; diff --git a/TimelineView/TimelineView.h b/TimelineView/TimelineView.h index b5a5750..03c1458 100644 --- a/TimelineView/TimelineView.h +++ b/TimelineView/TimelineView.h @@ -54,7 +54,8 @@ typedef void (^TimelineViewAnimationBlock)(NSMapTable *moved, NSSet *deleted, NS - (void)scrollToItemAtIndex:(NSInteger)index atScrollPosition:(TimelineViewScrollPosition)scrollPosition animated:(BOOL)animated; @property (weak, nonatomic) IBOutlet iddataSource; -@property (weak, nonatomic) IBOutlet iddelegate; +@property (weak, nonatomic) IBOutlet idtimelineViewDelegate; +//@property (weak, nonatomic) IBOutlet iddelegate; @property (readonly, nonatomic) UITapGestureRecognizer *tapGestureRecognizer; @property (readonly, nonatomic) UILongPressGestureRecognizer *longPressGestureRecognizer; @property (assign, nonatomic) TimelineViewScrollDirection scrollDirection; diff --git a/TimelineView/TimelineView.m b/TimelineView/TimelineView.m index cf88b27..a77b236 100644 --- a/TimelineView/TimelineView.m +++ b/TimelineView/TimelineView.m @@ -13,7 +13,8 @@ @implementation TimelineView @synthesize dataSource; -@synthesize delegate; +@synthesize timelineViewDelegate; +//@synthesize delegate; @synthesize tapGestureRecognizer; @synthesize longPressGestureRecognizer; @synthesize scrollDirection; @@ -74,10 +75,10 @@ - (id)initWithCoder:(NSCoder *)aDecoder #pragma mark Properties #pragma mark - -- (void)setDelegate:(id)value + +- (void)setTimelineViewDelegate:(id)value { - delegate = value; - [super setDelegate:value]; + timelineViewDelegate = value; } - (void)setAllowsSelection:(BOOL)value @@ -259,8 +260,8 @@ - (void)moveItemAtIndex:(NSInteger)index toIndex:(NSInteger)newIndex if(existingKeys.count > 0 && ! [existingKeys containsObject:@(index)]) { @throw [NSException exceptionWithName:NSInternalInconsistencyException - reason:[NSString stringWithFormat:@"attempt to move items at indexes %@ and %d to same index %d", - [existingKeys lastObject], index, newIndex] + reason:[NSString stringWithFormat:@"attempt to move items at indexes %@ and %ld to same index %ld", + [existingKeys lastObject], (long)index, (long)newIndex] userInfo:nil]; } diff --git a/TimelineView/TimelineView_Private.h b/TimelineView/TimelineView_Private.h index 36096cf..2742ec6 100644 --- a/TimelineView/TimelineView_Private.h +++ b/TimelineView/TimelineView_Private.h @@ -32,7 +32,8 @@ CGPointSubtract_(CGPoint p1, CGPoint p2) { { // Properties __weak iddataSource; - __weak iddelegate; + __weak idtimelineViewDelegate; + //__weak iddelegate; UITapGestureRecognizer *tapGestureRecognizer; UILongPressGestureRecognizer *longPressGestureRecognizer; TimelineViewScrollDirection scrollDirection;