Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions TimelineView/TimelineView+Gestures.m
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,17 @@ - (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;
}

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) {
Expand All @@ -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];
}
}

Expand All @@ -139,38 +139,38 @@ - (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) {
[selectedIndexes removeAllIndexes];
}

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];
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion TimelineView/TimelineView+Mutation.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down
8 changes: 4 additions & 4 deletions TimelineView/TimelineView+Tiling.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down Expand Up @@ -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];
Expand Down
3 changes: 2 additions & 1 deletion TimelineView/TimelineView.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 id<TimelineViewDataSource>dataSource;
@property (weak, nonatomic) IBOutlet id<TimelineViewDelegate,UIScrollViewDelegate>delegate;
@property (weak, nonatomic) IBOutlet id<TimelineViewDelegate>timelineViewDelegate;
//@property (weak, nonatomic) IBOutlet id<UIScrollViewDelegate>delegate;
@property (readonly, nonatomic) UITapGestureRecognizer *tapGestureRecognizer;
@property (readonly, nonatomic) UILongPressGestureRecognizer *longPressGestureRecognizer;
@property (assign, nonatomic) TimelineViewScrollDirection scrollDirection;
Expand Down
13 changes: 7 additions & 6 deletions TimelineView/TimelineView.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

@implementation TimelineView
@synthesize dataSource;
@synthesize delegate;
@synthesize timelineViewDelegate;
//@synthesize delegate;
@synthesize tapGestureRecognizer;
@synthesize longPressGestureRecognizer;
@synthesize scrollDirection;
Expand Down Expand Up @@ -74,10 +75,10 @@ - (id)initWithCoder:(NSCoder *)aDecoder
#pragma mark Properties
#pragma mark -

- (void)setDelegate:(id<TimelineViewDelegate,UIScrollViewDelegate>)value

- (void)setTimelineViewDelegate:(id<TimelineViewDelegate>)value
{
delegate = value;
[super setDelegate:value];
timelineViewDelegate = value;
}

- (void)setAllowsSelection:(BOOL)value
Expand Down Expand Up @@ -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];
}

Expand Down
3 changes: 2 additions & 1 deletion TimelineView/TimelineView_Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ CGPointSubtract_(CGPoint p1, CGPoint p2) {
{
// Properties
__weak id<TimelineViewDataSource>dataSource;
__weak id<TimelineViewDelegate,UIScrollViewDelegate>delegate;
__weak id<TimelineViewDelegate>timelineViewDelegate;
//__weak id<UIScrollViewDelegate>delegate;
UITapGestureRecognizer *tapGestureRecognizer;
UILongPressGestureRecognizer *longPressGestureRecognizer;
TimelineViewScrollDirection scrollDirection;
Expand Down