I want to make an effect with the type of the custom An attempt to appear among the three attempts to try to size of 140 * 85 on both sides of the other two are 100 * 70 to show the width of the screen are respectively 80 below is my code now How do I change? #717
I want to make an effect with the type of the custom An attempt to appear among the three attempts to try to size of 140 * 85 on both sides of the other two are 100 * 70 to show the width of the screen are respectively 80 below is my code now How do I change?
- (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel
{
return [_items count];
}
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view
{
UILabel *label = nil;
//create new view if no view is available for recycling
if (view == nil)
{
view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 140, 85)];
//((UIImageView *)view).image = [UIImage imageNamed:@"page.png"];
view.backgroundColor = [UIColor grayColor];
view.contentMode = UIViewContentModeCenter;
label = [[UILabel alloc] initWithFrame:view.bounds];
label.backgroundColor = [UIColor clearColor];
label.textAlignment = UITextAlignmentCenter;
label.font = [label.font fontWithSize:50];
label.tag = 1;
[view addSubview:label];
}
else
{
label = (UILabel *)[view viewWithTag:1];
}
label.text = [_items[index] stringValue];
return view;
}
- (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value
{
switch (option)
{
case iCarouselOptionWrap:
{
return _wrap;
}
case iCarouselOptionFadeMax:
{
// if (carousel.type == iCarouselTypeCustom)
// {
// return 0.0f;
// }
return value;
}
case iCarouselOptionArc:
{
return 3 * M_PI * _arcSlider.value;
}
case iCarouselOptionRadius:
{
return value * _radiusSlider.value;
}
case iCarouselOptionTilt:
{
return _tiltSlider.value;
}
case iCarouselOptionSpacing:
{
return value * _spacingSlider.value;
}
default:
{
return value;
}
}
}
- (NSInteger)numberOfPlaceholdersInCarousel:(iCarousel *)carousel {
return 2;
}
- (UIView *)carousel:(iCarousel *)carousel placeholderViewAtIndex:(NSInteger)index reusingView:(nullable UIView *)view {
UILabel *label = nil;
//create new view if no view is available for recycling
if (view == nil)
{
view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 70)];
//((UIImageView *)view).image = [UIImage imageNamed:@"page.png"];
view.backgroundColor = [UIColor grayColor];
view.contentMode = UIViewContentModeCenter;
label = [[UILabel alloc] initWithFrame:view.bounds];
label.backgroundColor = [UIColor clearColor];
label.textAlignment = UITextAlignmentCenter;
label.font = [label.font fontWithSize:50];
label.tag = 1;
[view addSubview:label];
}
else
{
//get a reference to the label in the recycled view
label = (UILabel *)[view viewWithTag:1];
}
//set item label
//remember to always set any properties of your carousel item
//views outside of the `if (view == nil) {...}` check otherwise
//you'll get weird issues with carousel item content appearing
//in the wrong place in the carousel
label.text = [_items[index] stringValue];
return view;
}
- (CATransform3D)carousel:(iCarousel *)carousel itemTransformForOffset:(CGFloat)offset baseTransform:(CATransform3D)transform {
CGFloat distance = 100.0f; //number of pixels to move the items away from camera
CGFloat spacing = 0.5; //extra spacing for center item
CGFloat clampedOffset = MIN(1.0, MAX(-1.0, offset));
CGFloat z = - fabs(clampedOffset) * distance;
offset += clampedOffset * spacing;
return CATransform3DTranslate(transform, offset * carousel.itemWidth, 0.0f, z);
}
I want to make an effect with the type of the custom An attempt to appear among the three attempts to try to size of 140 * 85 on both sides of the other two are 100 * 70 to show the width of the screen are respectively 80 below is my code now How do I change?