iCaroul详解

更新时间:2023-05-09 08:44:36 阅读: 评论:0

iCaroul详解
Documentation
Supported OS & SDK Versions
⽀持的OS & SDK版本
Supported build target - iOS 5.1 / Mac OS 10.7 (Xcode4.3.3, Apple LLVM compiler 3.1)
⽀持的编译⽬标-iOS 5.1 / Mac OS 10.7 (Xcode 4.3.3, Apple LLVM compiler3.1)
Earliest supported deployment target - iOS 4.3 / Mac OS10.7
最早⽀持的开发⽬标-iOS 4.3 / Mac OS 10.7
Earliest compatible deployment target - iOS 3.2 / Mac OS10.6
最早兼容的开发⽬标- iOS 3.2 / Mac OS10.6
NOTE: 'Supported' means that the library has been testedwith this version. 'Compatible' means that th
e library should work on this OSversion (i.e. it doesn't rely on any unavailable SDK features) but is no longerbeing tested for compatibility and may require tweaking or bug fixes to runcorrectly.
注意:“⽀持”的意思是这个版本的库已经被测试过了。“可兼容”的意思是在这个版本上这个库是可以⼯作的(它并不依赖于任何不可获得的sdk特性)但是已经不再对兼容性做测试,并且可能需要稍作改动或bug修复来正确运⾏。
ARC Compatibility
arc兼容性
As of version 1.6.1, iCaroul automatically works withboth ARC and non-ARC projects through conditional compilation. There is no needto exclude iCaroul files from the ARC validation process, or to convertiCaroul using the ARC conversion tool.
作为1.6.1版本,iCaroul通过条件性编译,可以⾃动⼯作在arc和⾮arc的⼯程中。没有必要从arc确认程序中排除iCaroul⽂件,或者去使⽤arc转换⼯具去转换iCaroul。
Thread Safety
线程安全
iCaroul is derived from UIView and - as with all UIKitcomponents - it should only be accesd from the main thread. You may wish tou threads for loading or updating caroul contents or items, but alwaynsure that once your content has loaded, you switch back to the main threadbefore updating the caroul.
iCaroul源于UIView,并且-和所有 UIKit 组建⼀样-它只能从主线程中获取。你可能希望使⽤线程来下载或更新caroul内容或条⽬,但是总是确保⼀旦你的内容已经被加载了,在更新caroul之前你需要切换回主线程。
Installation
安装
To u the iCaroul class in an app, just drag theiCaroul class files (demo files and asts are not needed) into your projectand add the QuartzCore framework.
在app中使⽤iCaroul类,只需要将iCaroul类⽂件(⽰例⽂件和“资产”不需要)拖拽到你的⼯程中,并且添加QuartzCore framework。
Chameleon Support
变⾊龙⽀持
Caroul Types
Caroul类型
iCaroul supportsthe following built-in display types:
Caroul⽀持以下内置的展⽰样式:
iCaroulTypeLinear
线性的
iCaroulTypeRotary
可旋转的
iCaroulTypeInvertedRotary
反向旋转式
iCaroulTypeCylinder
圆柱式
iCaroulTypeInvertedCylinder
反向圆柱式
iCaroulTypeWheel
车轮式
iCaroulTypeInvertedWheel
反向车轮式
iCaroulTypeCoverFlow
封⾯流
iCaroulTypeCoverflow2
封⾯流样式2
iCaroulTypeTimeMachine
时光机
iCaroulTypeInvertedTimeMachine
反向时光机
You can alsoimplement your own bespoke caroul styles using iCaroulTypeCustom and
thecaroul:itemTransformForOfft:baTransform: delegate method.
你也可以使⽤iCaroulTypeCustom和caroul:itemTransformForOfft:baTransform:代理⽅法来实现⾃⼰的定制caroul样式
NOTE: Thedifference between iCaroulTypeCoverFlow and iCaroulTypeCoverFlow2 types is quite subtle, however the logic for iCaroulTypeCoverFlow2 is substantially more complex. If you flick the caroul they arebasically identical, but if you drag the caroul slowly with your finger thedif
ference should be apparent. iCaroulTypeCoverFlow2 is designed to simulate the standard Apple CoverFlow effect as cloly aspossible and may change subtly in future in the interests of that goal.
注意:iCaroulTypeCoverFlow和 iCaroulTypeCoverFlow2样式的不同之处很细微,然⽽,iCaroulTypeCoverFlow2的逻辑相当复杂。如果你轻弹caroul,他们基本上是⼀样的,但是如果你使⽤⼿指慢慢拖动caroul,不同点就会明
显。iCaroulTypeCoverFlow2 是为了模拟尽可能接近标准的苹果封⾯流效果⽽设计的,并且可能在未来会为了这个⽬标⽽巧妙地变化。
Properties
属性
The iCaroul hasthe following properties (note: for Mac OS, substitute NSView for UIView whenusing properties):
iCaroul有以下属性(注意:对于Mac OS,当使⽤属性时⽤NSView替换UIView)
@property (nonatomic, weak) IBOutlet id dataSource;
An object thatsupports the iCaroulDataSource protocol and can provide views to populate thecaroul.
⼀个⽀持iCaroulDataSource协议且能提供视图来填充caroul的对象。
@property (nonatomic, weak) IBOutlet id delegate;
An object thatsupports the iCaroulDelegate protocol and can respond to caroul events andlayout requests.
⼀个⽀持iCaroulDelegate协议且可以响应iCaroul事件和布局请求的 对象。
@property (nonatomic, assign) iCaroulType type;
Ud to switch thecaroul display type (e above for details).
⽤来变换caroul展⽰样式(细节见上⽂)
@property (nonatomic, assign) CGFloat perspective;
Ud to tweak theperspective foreshortening effect for the various 3D caroul views. Should bea ne
gative value, less than 0 and greater than -0.01. Values outside of thisrange will yield very strange results. The default is -1/500, or -0.005;
⽤来稍稍调整在多种3dcaroul视图中 视觉按照透视法缩短效果的,它应该是⼀个负数,⼩于0且⼤于-0.01,这个范围之外的值将会产⽣⾮常奇怪的结果。默认值是-1/500, or -0.005。
@property (nonatomic, assign) CGSize contentOfft;
This property isud to adjust the offt of the caroul item views relative to the center ofthe caroul. It defaults to CGSizeZero, meaning that the caroul items arecentered. Changing this value moves the caroul items without changing theirperspective, i.e. the vanishing point moves with the caroul items, so if youmove the caroul items down, it does
not appear as if you are looking down on the caroul.
这个属性⽤来调整caroul item views相对于caroul中⼼的边距。它的默认值是CGSizeZero,意思是caroul items是居中的。改变这个属性的值来移动caroul items⽽不必改变他们的视觉。消失点随着caroul items移动,所以,如果你把caroul items移动到下边,如果你在caroul上向下看时他就不会出现。
@property (nonatomic, assign) CGSize viewpointOfft;
This property isud to adjust the ur viewpoint relative to the caroul items. It has theopposite effect to adjusting the contentOfft, i.e. if you move the viewpointup then the caroul appears to move down. Unlike the contentOfft, moving theviewpoint also changes the perspective vanishing point relative to the caroulitems, so if you move the viewpoint up, it will appear as if you are lookingdown on the caroul.
这个属性⽤来调整相对于caroul items的 ⽤户视点,它有⼀个副作⽤就是调整contentOfft。如果你向上移动视点,然后caroul 显⽰是向下移动。与 contentOfft不同,移动视点也会改变和caroul items有关的视⾓消失点,所以如果你向上移动视点,他就会像你在caroul上向下看⼀样出现。
@property (nonatomic, assign) CGFloat decelerationRate;
The rate at whichthe caroul decelerates when flicked. Higher values mean slower deceleration.The default value is 0.95. Values should be in the range 0.0 (caroul stopsimmediately when relead) to 1.0 (caroul continues indefinitely withoutslowing down, unless it reaches the end).
这个率⽤于caroul被快速轻击时caroul减速率。值越⼤表⽰减速越慢。默认值是0.95.值应该在0.0(设置为这个值时,caroul被释放时⽴即停⽌滚动)和1.0(设置为这个值时,caroul继续⽆限滚动⽽不减速,直到它到达底部)之间。
@property (nonatomic, assign) BOOL bounces;
Sets whether thecaroul should bounce past the end and return, or stop dead. Note that thishas no effect on caroul types that are designed to wrap, or where thecaroulShouldWrap delegate method returns YES.
设置caroul在超出底部和返回时是否应该弹跳,或者是停⽌并挂掉。注意,在caroul样式设置为缠绕样式时或者caroulShouldWrap代理⽅法返回为yes时,这个属性不起作⽤。
@property (nonatomic, assign) CGFloat bounceDistance;
The maximumdistance that a non-wrapped caroul will bounce when it overshoots the end.This is measured in multiples of the itemWidth, so a value of 1.0 would meansthe caroul will bounce by one whole item width, a value of 0.5 would be halfan item's width, and so on. The default value is 1.0;
⼀个⾮包裹样式的caroul在超过底部时将弹跳的最⼤距离。这个⽤itemWidth的倍数来衡量的,所以1.0这个值意味着弹跳⼀整个item的宽度,0.5这个值是⼀个item宽度的⼀半,以此类推。默认值是1.0.
@property (nonatomic, assign, getter = isScrollEnabled) BOOL scrollEnabled;
Enables anddisables ur scrolling of the caroul. The caroul can still be scrolledprogrammatically if this property is t to NO.
使能或者禁⽌⽤户滚动caroul。如果这个值被设为no,caroul仍然可以以编程⽅式被滚动。
@property (nonatomic, readonly, getter = isWrapEnabled) BOOL wrapEnabled;
Returns YES ifwrapping is enabled and NO if it isn't. This property is read only. If you wishto override the default value, implement the caroul:valueForOption:withDefault: delegate method and return a value for iCaroulOptionWrap.
如果打包被使能的话,返回yes,如果不是返回no。这个属性是只读的。如果你想重写这个默认值,实
现caroul:valueForOption:withDefault:⽅法且给iCaroulOptionWrap返回⼀个值。
@property (nonatomic, readonly) NSInteger numberOfItems;
The number of itemsin the caroul (read only). To t this, implement the numberOfItemsInCaroul: dataSource method. Note that not all of the item views will be loaded orvisible at a given point in time - the caroul loads item views on demand asit scrolls.
caroul中 items的数量(只读),要设置他的话,实现 numberOfItemsInCaroul:这个数据源⽅法。注意,所有这些item views在⼀个给定的时间点将会被加载或者可见-caroul当它滚动的时候经要求加载item views。
@property (nonatomic, readonly) NSInteger numberOfPlaceholders;
The number ofplaceholder views to display in the caroul (read only). To t this,implement thenumberOfPlaceholdersInCaroul: dataSource method.
在caroul中展⽰的占位视图的数量(只读)。要设置他,实现⼀下numberOfPlaceholdersInCaroul:这个数据源⽅法。
@property (nonatomic, readonly) NSInteger numberOfVisibleItems;
The maximum numberof caroul item views to be displayed concurrently on screen (read only). Thisproperty is important for performance optimisation, and is calculatedautomatically bad on the caroul type and view frame. If you wish tooverride the default value, implement thecaroul:valueForOption:withDefault: delegate method and return a value for iCaroulOptionVisibleItems.
同时显⽰在屏幕上的caroul itemviews的最⼤数量(只读)。这个属性对执⾏最优化很重要,且是基于caroul的样式和视图的frame 被⾃动计算的。如果你想重写这个默认值,实现⼀下caroul:valueForOption:withDefault:(原⽂件中没有找到这个⽅法⼯程中使⽤的是- (NSUInteger)numberOfVisibleItemsInCaroul:(iCaroul *)caroul数据源⽅法)这个代理⽅法且
给iCaroulOptionVisibleItems返回⼀个值。

本文发布于:2023-05-09 08:44:36,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/90/101797.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:样式   属性   返回   反向   设置   可能   加载   需要
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图