Skip to content

Commit

Permalink
Update to 1.8 beta 9
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklockwood committed Nov 6, 2013
1 parent b4e864b commit 18fd490
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 35 deletions.
3 changes: 2 additions & 1 deletion RELEASE NOTES.md
@@ -1,14 +1,15 @@
Verson 1.8 beta

- iCarousel now requires ARC
- iCarousel now requires 64-bit processors on Mac OS
- iCarousel now requires 64-bit processors on Mac OS 10.6
- Added pagingEnabled property to force carousel to only move a single index per swipe
- Fixed bug which occasionally caused carousel item views to pop-in from right
- Removed all deprecated methods and APIs
- Added iCarouselOptionFadeMinAlpha option for setting minimum fade
- Setting scrollOffset now lets you exactly mirror behaviour from one carousel to another
- Fixed bug where item indexes were selected incorrectly when tapping views in vertical mode
- Perspective and viewpointOffset properties can now be animated
- Now conforms to -Wextra warning level

Version 1.7.6

Expand Down
2 changes: 1 addition & 1 deletion iCarousel.podspec
Expand Up @@ -7,7 +7,7 @@ Pod::Spec.new do |s|
s.authors = { "Nick Lockwood" => "support@charcoaldesign.co.uk" }
s.source = { :git => "https://github.com/nicklockwood/iCarousel.git", :tag => "1.7.6" }
s.source_files = 'iCarousel'
s.requires_arc = false
s.requires_arc = true
s.frameworks = 'QuartzCore'
s.ios.deployment_target = '4.3'
s.osx.deployment_target = '10.6'
Expand Down
2 changes: 1 addition & 1 deletion iCarousel/iCarousel.h
@@ -1,7 +1,7 @@
//
// iCarousel.h
//
// Version 1.8 beta 8
// Version 1.8 beta 9
//
// Created by Nick Lockwood on 01/04/2011.
// Copyright 2011 Charcoal Design
Expand Down
58 changes: 26 additions & 32 deletions iCarousel/iCarousel.m
@@ -1,7 +1,7 @@
//
// iCarousel.m
//
// Version 1.8 beta 8
// Version 1.8 beta 9
//
// Created by Nick Lockwood on 01/04/2011.
// Copyright 2011 Charcoal Design
Expand Down Expand Up @@ -59,26 +59,26 @@

@implementation NSObject (iCarousel)

- (NSUInteger)numberOfPlaceholdersInCarousel:(iCarousel *)carousel { return 0; }
- (void)carouselWillBeginScrollingAnimation:(iCarousel *)carousel {}
- (void)carouselDidEndScrollingAnimation:(iCarousel *)carousel {}
- (void)carouselDidScroll:(iCarousel *)carousel {}
- (NSUInteger)numberOfPlaceholdersInCarousel:(__unused iCarousel *)carousel { return 0; }
- (void)carouselWillBeginScrollingAnimation:(__unused iCarousel *)carousel {}
- (void)carouselDidEndScrollingAnimation:(__unused iCarousel *)carousel {}
- (void)carouselDidScroll:(__unused iCarousel *)carousel {}

- (void)carouselCurrentItemIndexDidChange:(iCarousel *)carousel {}
- (void)carouselWillBeginDragging:(iCarousel *)carousel {}
- (void)carouselDidEndDragging:(iCarousel *)carousel willDecelerate:(BOOL)decelerate {}
- (void)carouselWillBeginDecelerating:(iCarousel *)carousel {}
- (void)carouselDidEndDecelerating:(iCarousel *)carousel {}
- (void)carouselCurrentItemIndexDidChange:(__unused iCarousel *)carousel {}
- (void)carouselWillBeginDragging:(__unused iCarousel *)carousel {}
- (void)carouselDidEndDragging:(__unused iCarousel *)carousel willDecelerate:(__unused BOOL)decelerate {}
- (void)carouselWillBeginDecelerating:(__unused iCarousel *)carousel {}
- (void)carouselDidEndDecelerating:(__unused iCarousel *)carousel {}

- (BOOL)carousel:(iCarousel *)carousel shouldSelectItemAtIndex:(NSInteger)index { return YES; }
- (void)carousel:(iCarousel *)carousel didSelectItemAtIndex:(NSInteger)index {}
- (BOOL)carousel:(__unused iCarousel *)carousel shouldSelectItemAtIndex:(__unused NSInteger)index { return YES; }
- (void)carousel:(__unused iCarousel *)carousel didSelectItemAtIndex:(__unused NSInteger)index {}

- (CGFloat)carouselItemWidth:(iCarousel *)carousel { return 0; }
- (CATransform3D)carousel:(iCarousel *)carousel
itemTransformForOffset:(CGFloat)offset
- (CGFloat)carouselItemWidth:(__unused iCarousel *)carousel { return 0; }
- (CATransform3D)carousel:(__unused iCarousel *)carousel
itemTransformForOffset:(__unused CGFloat)offset
baseTransform:(CATransform3D)transform { return transform; }
- (CGFloat)carousel:(iCarousel *)carousel
valueForOption:(iCarouselOption)option
- (CGFloat)carousel:(__unused iCarousel *)carousel
valueForOption:(__unused iCarouselOption)option
withDefault:(CGFloat)value { return value; }

@end
Expand Down Expand Up @@ -446,10 +446,10 @@ - (CGFloat)alphaForItemWithOffset:(CGFloat)offset

- (CGFloat)valueForOption:(iCarouselOption)option withDefault:(CGFloat)value
{
return [_delegate carousel:self valueForOption:option withDefault:value];
return _delegate? [_delegate carousel:self valueForOption:option withDefault:value]: value;
}

- (CATransform3D)transformForItemView:(UIView *)view withOffset:(CGFloat)offset
- (CATransform3D)transformForItemViewWithOffset:(CGFloat)offset
{
//set up base transform
CATransform3D transform = CATransform3DIdentity;
Expand Down Expand Up @@ -639,11 +639,6 @@ - (CATransform3D)transformForItemView:(UIView *)view withOffset:(CGFloat)offset
return CATransform3DTranslate(transform, offset * _itemWidth * tilt, 0.0f, offset * _itemWidth * spacing);
}
}
default:
{
//shouldn't ever happen
return CATransform3DIdentity;
}
}
}

Expand Down Expand Up @@ -816,7 +811,7 @@ - (void)transformItemView:(UIView *)view atIndex:(NSInteger)index
}

//calculate transform
CATransform3D transform = [self transformForItemView:view withOffset:offset];
CATransform3D transform = [self transformForItemViewWithOffset:offset];

//transform view
view.superview.layer.transform = transform;
Expand Down Expand Up @@ -959,7 +954,6 @@ - (void)updateNumberOfVisibleItems
case iCarouselTypeTimeMachine:
case iCarouselTypeInvertedTimeMachine:
case iCarouselTypeCustom:
default:
{
//slightly arbitrary number, chosen for performance reasons
_numberOfVisibleItems = MAX_VISIBLE_ITEMS;
Expand Down Expand Up @@ -1888,12 +1882,12 @@ - (BOOL)viewOrSuperview:(UIView *)view implementsSelector:(SEL)selector
//https://gist.github.com/mattjgalloway/6279363
//https://gist.github.com/shaps80/6279008

Class class = [view class];
while (class && class != [UIView class])
Class viewClass = [view class];
while (viewClass && viewClass != [UIView class])
{
int unsigned numberOfMethods;
Method *methods = class_copyMethodList(class, &numberOfMethods);
for (int i = 0; i < numberOfMethods; i++)
unsigned int numberOfMethods;
Method *methods = class_copyMethodList(viewClass, &numberOfMethods);
for (unsigned int i = 0; i < numberOfMethods; i++)
{
if (method_getName(methods[i]) == selector)
{
Expand All @@ -1902,7 +1896,7 @@ - (BOOL)viewOrSuperview:(UIView *)view implementsSelector:(SEL)selector
}
}
if (methods) free(methods);
class = [class superclass];
viewClass = [viewClass superclass];
}

if (view.superview && view.superview != self.contentView)
Expand Down

0 comments on commit 18fd490

Please sign in to comment.