@@ -39,7 +39,7 @@ - (id)initWithFrame:(CGRect)frame
39
39
NSString *resourcePath = [[NSBundle mainBundle ] resourcePath ];
40
40
NSString *bundlePath = [resourcePath stringByAppendingPathComponent: @" RS3DSegmentedControl.bundle" ];
41
41
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 ) ]];
43
43
44
44
[self addSubview: _backgroundImage];
45
45
@@ -49,7 +49,7 @@ - (id)initWithFrame:(CGRect)frame
49
49
_carousel.decelerationRate = 0 .6f ;
50
50
_carousel.scrollSpeed = 0 .5f ;
51
51
_carousel.stopAtItemBoundary = NO ;
52
- _carousel.dataSource = self;
52
+ _carousel.dataSource = self;
53
53
54
54
[self addSubview: _carousel];
55
55
@@ -59,6 +59,11 @@ - (id)initWithFrame:(CGRect)frame
59
59
return self;
60
60
}
61
61
62
+ - (void )layoutSubviews
63
+ {
64
+ [super layoutSubviews ];
65
+ self.backgroundImage .frame = self.bounds ;
66
+ }
62
67
63
68
64
69
- (void )setDelegate : (id <RS3DSegmentedControlDelegate>)delegate
@@ -151,8 +156,8 @@ - (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option
151
156
switch (option)
152
157
{
153
158
case iCarouselOptionWrap:
154
- return YES ;
155
-
159
+ return YES ;
160
+
156
161
case iCarouselOptionFadeMax:
157
162
{
158
163
return 0 .0f ;
@@ -165,12 +170,12 @@ - (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option
165
170
{
166
171
return 1 .9f ;
167
172
}
168
-
173
+
169
174
case iCarouselOptionOffsetMultiplier:
170
175
{
171
176
return 1 .5f ;
172
177
}
173
-
178
+
174
179
default :
175
180
{
176
181
return value;
@@ -184,7 +189,7 @@ - (CATransform3D)carousel:(iCarousel *)carousel itemTransformForOffset:(CGFloat)
184
189
{
185
190
NSInteger count = 10 ;
186
191
187
- CGFloat spacing = 1 . 1f ;
192
+ CGFloat spacing = self. bounds . size . width / 290 . f ;
188
193
189
194
CGFloat arc = M_PI * 2 .0f ;
190
195
@@ -206,7 +211,7 @@ - (void)carouselDidEndScrollingAnimation:(iCarousel *)carousel
206
211
207
212
return ;
208
213
}
209
-
214
+
210
215
[_delegate didSelectSegmentAtIndex: carousel.currentItemIndex segmentedControl: self ];
211
216
}
212
217
0 commit comments