Skip to content

Commit 295da1d

Browse files
committed
Release 0.2.3
1 parent 1791fea commit 295da1d

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

RS3DSegmentedControl/RS3DSegmentedControl.m

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ - (id)initWithFrame:(CGRect)frame
3939
NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
4040
NSString *bundlePath = [resourcePath stringByAppendingPathComponent:@"RS3DSegmentedControl.bundle"];
4141
NSString *imagePath = [bundlePath stringByAppendingPathComponent:@"RS3DSegmentedControlBg.png"];
42-
self.backgroundImage = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:imagePath]];
42+
self.backgroundImage = [[UIImageView alloc] initWithImage:[[UIImage imageWithContentsOfFile:imagePath] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 10, 0, 10)]];
4343

4444
[self addSubview:_backgroundImage];
4545

@@ -49,7 +49,7 @@ - (id)initWithFrame:(CGRect)frame
4949
_carousel.decelerationRate = 0.6f;
5050
_carousel.scrollSpeed = 0.5f;
5151
_carousel.stopAtItemBoundary = NO;
52-
_carousel.dataSource = self;
52+
_carousel.dataSource = self;
5353

5454
[self addSubview:_carousel];
5555

@@ -59,6 +59,11 @@ - (id)initWithFrame:(CGRect)frame
5959
return self;
6060
}
6161

62+
- (void)layoutSubviews
63+
{
64+
[super layoutSubviews];
65+
self.backgroundImage.frame = self.bounds;
66+
}
6267

6368

6469
- (void)setDelegate:(id<RS3DSegmentedControlDelegate>)delegate
@@ -151,8 +156,8 @@ - (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option
151156
switch (option)
152157
{
153158
case iCarouselOptionWrap:
154-
return YES;
155-
159+
return YES;
160+
156161
case iCarouselOptionFadeMax:
157162
{
158163
return 0.0f;
@@ -165,12 +170,12 @@ - (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option
165170
{
166171
return 1.9f;
167172
}
168-
173+
169174
case iCarouselOptionOffsetMultiplier:
170175
{
171176
return 1.5f;
172177
}
173-
178+
174179
default:
175180
{
176181
return value;
@@ -184,7 +189,7 @@ - (CATransform3D)carousel:(iCarousel *)carousel itemTransformForOffset:(CGFloat)
184189
{
185190
NSInteger count = 10;
186191

187-
CGFloat spacing = 1.1f;
192+
CGFloat spacing = self.bounds.size.width / 290.f;
188193

189194
CGFloat arc = M_PI * 2.0f;
190195

@@ -206,7 +211,7 @@ - (void)carouselDidEndScrollingAnimation:(iCarousel *)carousel
206211

207212
return;
208213
}
209-
214+
210215
[_delegate didSelectSegmentAtIndex:carousel.currentItemIndex segmentedControl:self];
211216
}
212217

0 commit comments

Comments
 (0)