From 719f8f2504eb4d9486206e265a43f4a16cf72ec7 Mon Sep 17 00:00:00 2001 From: Nick Lockwood Date: Thu, 27 Jun 2013 15:50:09 +0100 Subject: [PATCH] Updated to version 1.7.5 --- .../xcschemes/iCarouselChameleonDemo.xcscheme | 6 +- .../iCarouselMac.xcodeproj/project.pbxproj | 24 ++++- .../project.pbxproj | 14 ++- .../StoryboardExample/ViewController.m | 4 +- .../en.lproj/MainStoryboard.storyboard | 30 +++--- .../project.pbxproj | 2 +- .../iOS Demo/iCarouselExampleViewController.m | 11 ++- LICENCE.md | 2 +- README.md | 4 - RELEASE NOTES.md | 5 + iCarousel.podspec | 4 +- iCarousel/iCarousel.h | 2 +- iCarousel/iCarousel.m | 91 ++++++------------- 13 files changed, 106 insertions(+), 93 deletions(-) diff --git a/Examples/Chameleon Demo/iCarouselChameleonDemo.xcodeproj/xcuserdata/nick.xcuserdatad/xcschemes/iCarouselChameleonDemo.xcscheme b/Examples/Chameleon Demo/iCarouselChameleonDemo.xcodeproj/xcuserdata/nick.xcuserdatad/xcschemes/iCarouselChameleonDemo.xcscheme index 96f498c6..32fdba51 100644 --- a/Examples/Chameleon Demo/iCarouselChameleonDemo.xcodeproj/xcuserdata/nick.xcuserdatad/xcschemes/iCarouselChameleonDemo.xcscheme +++ b/Examples/Chameleon Demo/iCarouselChameleonDemo.xcodeproj/xcuserdata/nick.xcuserdatad/xcschemes/iCarouselChameleonDemo.xcscheme @@ -23,8 +23,8 @@ @@ -41,7 +41,7 @@ - + - - - + - - - - - - - - + + @@ -30,11 +22,22 @@ + + + + + + + + + + + @@ -42,6 +45,9 @@ + + + diff --git a/Examples/iOS Demo/iCarouselExample.xcodeproj/project.pbxproj b/Examples/iOS Demo/iCarouselExample.xcodeproj/project.pbxproj index 4fa31e77..17ed786d 100644 --- a/Examples/iOS Demo/iCarouselExample.xcodeproj/project.pbxproj +++ b/Examples/iOS Demo/iCarouselExample.xcodeproj/project.pbxproj @@ -158,7 +158,7 @@ 01308D8513491C3500453707 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0450; + LastUpgradeCheck = 0460; }; buildConfigurationList = 01308D8813491C3500453707 /* Build configuration list for PBXProject "iCarouselExample" */; compatibilityVersion = "Xcode 3.2"; diff --git a/Examples/iOS Demo/iCarouselExampleViewController.m b/Examples/iOS Demo/iCarouselExampleViewController.m index cfba06ea..dd6852bb 100644 --- a/Examples/iOS Demo/iCarouselExampleViewController.m +++ b/Examples/iOS Demo/iCarouselExampleViewController.m @@ -137,8 +137,8 @@ - (IBAction)removeItem if (carousel.numberOfItems > 0) { NSInteger index = carousel.currentItemIndex; - [carousel removeItemAtIndex:index animated:YES]; [items removeObjectAtIndex:index]; + [carousel removeItemAtIndex:index animated:YES]; } } @@ -284,4 +284,13 @@ - (CGFloat)carousel:(iCarousel *)_carousel valueForOption:(iCarouselOption)optio } } +#pragma mark - +#pragma mark iCarousel taps + +- (void)carousel:(iCarousel *)carousel didSelectItemAtIndex:(NSInteger)index +{ + NSNumber *item = [self.items objectAtIndex:index]; + NSLog(@"Tapped view number: %@", item); +} + @end diff --git a/LICENCE.md b/LICENCE.md index eafe5333..2bd70392 100755 --- a/LICENCE.md +++ b/LICENCE.md @@ -1,6 +1,6 @@ iCarousel -Version 1.7.4, February 1st, 2013 +Version 1.7.5, February 1st, 2013 Copyright (C) 2011 Charcoal Design diff --git a/README.md b/README.md index 4ecb37b1..f0738d30 100644 --- a/README.md +++ b/README.md @@ -173,10 +173,6 @@ By default, the carousel will come to rest at an exact item boundary when it is By default whenever the carousel stops moving it will automatically scroll to the nearest item boundary. If you set this property to NO, the carousel will not scroll after stopping and will stay wherever it is, even if it's not perfectly aligned on the current index. The exception to this is that if wrapping is disabled and `bounces` is set to YES then regardless of this setting, the carousel will automatically scroll back to the first or last item index if it comes to rest beyond the end of the carousel. - @property (nonatomic, assign) BOOL useDisplayLink; - -By default on iOS iCarousel will use CADisplayLink instead of NSTimer for animations. On Mac OS, the CVDisplayLink API is used instead. This provides better synchronisation with the screen refresh, but can occasionally prevents the animation working properly when the carousel is combined with other views or animations. If you find that the carousel is not continuing to move after being dragged, try setting this property to NO. - @property (nonatomic, assign, getter = isVertical) BOOL vertical; This property toggles whether the carousel is displayed horizontally or vertically on screen. All the built-in carousel types work in both orientations. Switching to vertical changes both the layout of the carousel and also the direction of swipe detection on screen. Note that custom carousel transforms are not affected by this property, however the swipe gesture direction will still be affected. diff --git a/RELEASE NOTES.md b/RELEASE NOTES.md index 8ac3a2ac..0dd528f7 100755 --- a/RELEASE NOTES.md +++ b/RELEASE NOTES.md @@ -1,3 +1,8 @@ +Version 1.7.5 + +- Fixed an issue with latest llvm compiler +- Fixed confict between iCarousel animation and UIScrollView scrolling + Version 1.7.4 - Fixed deprecation warnings when using Xcode 4.6 diff --git a/iCarousel.podspec b/iCarousel.podspec index 480af32e..0f0816d0 100644 --- a/iCarousel.podspec +++ b/iCarousel.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = "iCarousel" - s.version = "1.7.4" + s.version = "1.7.5" s.license = { :type => 'zlib', :file => 'LICENCE.md' } s.summary = "A class designed to simplify the implementation of various types of carousel." s.homepage = "https://github.com/nicklockwood/iCarousel" s.authors = { "Nick Lockwood" => "support@charcoaldesign.co.uk" } - s.source = { :git => "https://github.com/nicklockwood/iCarousel.git", :tag => "1.7.4" } + s.source = { :git => "https://github.com/nicklockwood/iCarousel.git", :tag => "1.7.5" } s.source_files = 'iCarousel' s.requires_arc = false s.frameworks = 'QuartzCore' diff --git a/iCarousel/iCarousel.h b/iCarousel/iCarousel.h index 60db7b6a..6131e0b4 100644 --- a/iCarousel/iCarousel.h +++ b/iCarousel/iCarousel.h @@ -1,7 +1,7 @@ // // iCarousel.h // -// Version 1.7.4 +// Version 1.7.5 // // Created by Nick Lockwood on 01/04/2011. // Copyright 2011 Charcoal Design diff --git a/iCarousel/iCarousel.m b/iCarousel/iCarousel.m index 621d734b..39665219 100644 --- a/iCarousel/iCarousel.m +++ b/iCarousel/iCarousel.m @@ -1,7 +1,7 @@ // // iCarousel.m // -// Version 1.7.4 +// Version 1.7.5 // // Created by Nick Lockwood on 01/04/2011. // Copyright 2011 Charcoal Design @@ -48,11 +48,13 @@ #if __has_feature(objc_arc) #define ah_retain self #define ah_dealloc self -#define release self -#define autorelease self +#define ah_release self +#define ah_autorelease self #else #define ah_retain retain #define ah_dealloc dealloc +#define ah_release release +#define ah_autorelease autorelease #define __bridge #endif #endif @@ -110,50 +112,6 @@ @interface iCarousel () @implementation iCarousel -@synthesize dataSource = _dataSource; -@synthesize delegate = _delegate; -@synthesize type = _type; -@synthesize perspective = _perspective; -@synthesize numberOfItems = _numberOfItems; -@synthesize numberOfPlaceholders = _numberOfPlaceholders; -@synthesize numberOfPlaceholdersToShow = _numberOfPlaceholdersToShow; -@synthesize numberOfVisibleItems = _numberOfVisibleItems; -@synthesize contentView = _contentView; -@synthesize itemViews = _itemViews; -@synthesize itemViewPool = _itemViewPool; -@synthesize placeholderViewPool = _placeholderViewPool; -@synthesize previousItemIndex = _previousItemIndex; -@synthesize itemWidth = _itemWidth; -@synthesize scrollOffset = _scrollOffset; -@synthesize offsetMultiplier = _offsetMultiplier; -@synthesize startVelocity = _startVelocity; -@synthesize timer = _timer; -@synthesize decelerating = _decelerating; -@synthesize scrollEnabled = _scrollEnabled; -@synthesize decelerationRate = _decelerationRate; -@synthesize bounceDistance = _bounceDistance; -@synthesize bounces = _bounces; -@synthesize contentOffset = _contentOffset; -@synthesize viewpointOffset = _viewpointOffset; -@synthesize startOffset = _startOffset; -@synthesize endOffset = _endOffset; -@synthesize scrollDuration = _scrollDuration; -@synthesize startTime = _startTime; -@synthesize scrolling = _scrolling; -@synthesize previousTranslation = _previousTranslation; -@synthesize wrapEnabled = _wrapEnabled; -@synthesize vertical = _vertical; -@synthesize dragging = _dragging; -@synthesize didDrag = _didDrag; -@synthesize scrollSpeed = _scrollSpeed; -@synthesize toggleTime = _toggleTime; -@synthesize toggle = _toggle; -@synthesize stopAtItemBoundary = _stopAtItemBoundary; -@synthesize scrollToItemBoundary = _scrollToItemBoundary; -@synthesize ignorePerpendicularSwipes = _ignorePerpendicularSwipes; -@synthesize animationDisableCount = _animationDisableCount; -@synthesize centerItemWhenSelected = _centerItemWhenSelected; - #pragma mark - #pragma mark Initialisation @@ -184,7 +142,7 @@ - (void)setUp UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(didPan:)]; panGesture.delegate = (id )self; [_contentView addGestureRecognizer:panGesture]; - [panGesture release]; + [panGesture ah_release]; #else @@ -227,10 +185,10 @@ - (void)dealloc { [self stopAnimation]; - [_contentView release]; - [_itemViews release]; - [_itemViewPool release]; - [_placeholderViewPool release]; + [_contentView ah_release]; + [_itemViews ah_release]; + [_itemViewPool ah_release]; + [_placeholderViewPool ah_release]; [super ah_dealloc]; } @@ -866,7 +824,7 @@ - (UIView *)containView:(UIView *)view CGRect frame = view.bounds; frame.size.width = _vertical? frame.size.width: _itemWidth; frame.size.height = _vertical? _itemWidth: frame.size.height; - UIView *containerView = [[[UIView alloc] initWithFrame:frame] autorelease]; + UIView *containerView = [[[UIView alloc] initWithFrame:frame] ah_autorelease]; #ifdef ICAROUSEL_IOS @@ -874,7 +832,7 @@ - (UIView *)containView:(UIView *)view UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTap:)]; tapGesture.delegate = (id )self; [containerView addGestureRecognizer:tapGesture]; - [tapGesture release]; + [tapGesture ah_release]; #else @@ -1225,7 +1183,7 @@ - (UIView *)dequeueItemView { [_itemViewPool removeObject:view]; } - return [view autorelease]; + return [view ah_autorelease]; } - (UIView *)dequeuePlaceholderView @@ -1235,7 +1193,7 @@ - (UIView *)dequeuePlaceholderView { [_placeholderViewPool removeObject:view]; } - return [view autorelease]; + return [view ah_autorelease]; } @@ -1262,7 +1220,7 @@ - (UIView *)loadViewAtIndex:(NSInteger)index withContainerView:(UIView *)contain if (view == nil) { - view = [[[UIView alloc] init] autorelease]; + view = [[[UIView alloc] init] ah_autorelease]; } [self setItemView:view forIndex:index]; if (containerView) @@ -1574,6 +1532,7 @@ - (void)removeItemAtIndex:(NSInteger)index animated:(BOOL)animated [UIView commitAnimations]; [UIView beginAnimations:nil context:nil]; + [UIView setAnimationDelay:0.1]; [UIView setAnimationDuration:INSERT_DURATION]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(depthSortViews)]; @@ -1734,11 +1693,19 @@ - (void)startAnimation { if (!_timer) { - _timer = [NSTimer scheduledTimerWithTimeInterval:1.0/60.0 - target:self - selector:@selector(step) - userInfo:nil - repeats:YES]; + self.timer = [NSTimer timerWithTimeInterval:1.0/60.0 + target:self + selector:@selector(step) + userInfo:nil + repeats:YES]; + + [[NSRunLoop mainRunLoop] addTimer:_timer forMode:NSDefaultRunLoopMode]; + +#ifdef ICAROUSEL_IOS + + [[NSRunLoop mainRunLoop] addTimer:_timer forMode:UITrackingRunLoopMode]; +#endif + } }