×

一、简介与环境搭建

CrossApp简介CrossApp摘要CrossApp坐标系浅谈CrossApp屏幕适配方案CrossApp源码结构CrossApp的MVC模式CrossApp项目结构及入口CrossApp内存管理CrossApp类结构图创建CrossApp工程CAVector、CAList、CADeque、CAMap(数据容器)Windows 开发下VS2013环境搭建Windows 开发下Android环境配置Mac OS 开发下Xcode环境搭建Mac OS 下iOS移植android环境配置

二、CrossApp简单控件的使用

DLayout(自适应布局)CALabel(显示文本)CAImage、CAImageView(显示一张图片)CAScale9ImageView(九宫格图片拉伸)CAButton(按钮)CATextView(多行输入框)CATextViewDelegateCASwitch(开关控件)CAProgress(进度条)CAAlertView(提示框)CAScrollView(滚动视图)CAScrollViewDelegateCAListView(列表)CAListViewDataSourceCAListViewDelegateCATableView(表单视图)CATableViewDataSourceCATableViewDelegateCATableViewCellCACollectionView(容器)CACollectionViewDataSourceCASlider(滑动条)CAStepper(步进控件)CAPageView(页面切换)CAPageViewDelegateCAWaterfallView(瀑布流控件)CAWaterfallViewDataSourceCAWaterfallViewDelegateCAWaterfallViewCellCATextField(输入框)CATextFieldDelegateCAAutoCollectionView(自动化布局容器)CAAutoCollectionViewDataSourceCAAutoCollectionViewDelegateCAVideoPlayerControlView(视频播放器控制视图)CAVideoPlayerControlViewDelegateCAWebView(Web视图控件)CAWebViewDelegateCAGifView(显示Gif图片)CARenderImage(图像渲染)CASegmentedControl(分段控制)CAPickerView(视图选择器)CAPickerViewDataSourceCAPickerViewDelegateCAActivityIndicatorView(活动指示器)CrossApp UIEdit(UI编辑器)

三、视图控制

CAViewController(视图控制器)CADrawerController(抽屉控制器)CANavigationController(导航控制器)CANavigationBarDelegateCANavigationBarItemCANavigationBarCATabBarController(标签栏控制器)CATabBarDelegateCATabBarItem

四、调用系统支持

CADevice

五、数据的解析与存储

CAUserDefault简单存储SQlite的使用json解析xml解析

六、网络

网络通信之httphttp请求网络图

七,动画

CAViewAnimation(动画实现)

八、宏定义

宏定义

九、其他控件的使用

CAViewCAViewDelegateCATextField(输入框1.2以前版本)CAObjectCAResponderCAPullToRefreshViewCAControlCAWindowCABarItemCABarButtonItemCASchedulerCAMediaDelegateCAKeypadDelegate

CAPickerView(视图选择器)


类说明

选择器控件,pickerView至少包括一个组件(component),每个组件包括供选择的子项(row)。


基类

CAView,CATableViewDataSource


CAPickerView 属性(点击查看方法介绍)

属性
说明
PickerViewDelegate 滑动事件代理
PickerViewDataSource 数据代理
FontSizeNormal 正常状态下的字体大小
FontSizeSelected 选中时的字体大小
FontColorNormal 正常状态下的字体颜色
FontColorSelected 选中时的字体颜色
SeparateColor 选中框的边框颜色


CAPickerView 方法(点击查看方法介绍)

方法 说明
create 创建,默认Frame为(0,0,0,0)
createWithFrame 创建,并指定其Frame,默认Frame为(0,0,0,0)
createWithCenter 创建,并设置其Center,默认Center为(0,0,0,0)
init 初始化
onEnter 进入
onExit 退出
visit 访问
initWithFrame 初始化,并指定其Frame
initWithCenter 初始化,并指定其Center
numberOfComponents 获取组件的数量
numberOfRowsInComponent 获取指定组件的row的数量
rowSizeForComponent 获取指定组件的size
viewForRow 获取row
reloadAllComponents 刷新所有组件
reloadComponent 刷新指定组件
selectRow 指定选中的row
selectedRowInComponent 获取当前被选中的row
setBackgroundColor 设置背景颜色


CAPickerView 属性说明

PickerViewDelegate

类型:CAPickerViewDelegate*

解释:pickerView的选中事件代理,包含一个选中时触发的接口,public get/set{}。


PickerViewDataSource

类型:CAPickerViewDataSource*

解释:pickerView的数据代理,详细接口请参考CAPickerViewDataSource代理类,public get/set{}。


FontSizeNormal

类型:float

解释:备选项的字体大小,public get/set{}。


FontSizeSelected

类型:float

解释:选中项的字体大小,public get/set{}。


FontColorNormal

类型:CAColor4B

解释:备选项的字体颜色,public get/set{}。


FontColorSelected

类型:CAColor4B

解释:选中项的字体颜色,public get/set{}。


SeparateColor

类型:CAColor4B

解释:选框的边框颜色,public get/set{}。


CAPickerView 方法说明

static CAPickerView* create();

返回值:CAPickerView*

参数:

解释:创建,默认Frame为(0,0,0,0)


static CAPickerView* createWithFrame(const DRect& rect);

返回值:CAPickerView*

参数:

类型
参数名 说明
DRect& rect 区域大小

解释:创建,并指定其Frame,默认Frame为(0,0,0,0)


static CAPickerView* createWithCenter(const DRect& rect);

返回值:CAPickerView*

参数:

类型
参数名 说明
DRect& rect 中心点的位置及大小

解释:创建,并设置其Center,默认Center为(0,0,0,0)


virtual bool init();

返回值:bool

参数:

解释:初始化


virtual void onEnter();

返回值:void

参数:

解释:进入


virtual void onExit();

返回值:void

参数:

解释:退出


virtual void visit();

返回值:void

参数:

解释:访问


virtual bool initWithFrame(const DRect& rect);

返回值:bool

参数:

类型
参数名 说明
DRect& rect 区域大小

解释:初始化,并指定其Frame


virtual bool initWithCenter(const DRect& rect);

返回值:bool

参数:

类型
参数名 说明
DRect& rect 中心点的位置及大小

解释:初始化,并指定其Center


virtual int numberOfComponents();

返回值:int

参数:

解释:获取组件的数量


virtual int numberOfComponents()

返回值:int

参数:

解释:返回pickerView中component的数量


virtual int numberOfRowsInComponent(unsigned int component)

返回值:int

参数:

类型
参数 说明
unsigned int component 指定的component

解释:返回pickerView中component的数量


virtual CCSize rowSizeForComponent(unsigned int component)

返回值:CCSize

参数:

类型
参数 说明
unsigned int component 指定的component

解释:获取指定组件的size


virtual CAView* viewForRow(unsigned int row, unsigned int component)

返回值:CAView*

参数:

类型
参数 说明
unsigned int row 指定的row
unsigned int  component 指定的component

解释:获取row


virtual void reloadAllComponents()

返回值:void

参数:

解释:刷新所有的组件,创建pickerView时必须手动刷新一次pickerView。

示例:

pickerView = CAPickerView::createWithCenter(CCRect(size.width*0.5, size.height*0.5, size.width*0.6, size.height*0.5));
pickerView->setDelegate(this);
pickerView->setDataSource(this);
pickerView->setFontSizeNormal(30 * CROSSAPP_ADPTATION_RATIO);
pickerView->setFontSizeSelected(30 * CROSSAPP_ADPTATION_RATIO);
pickerView->setFontColorNormal(CAColor_blueStyle);
pickerView->setFontColorSelected(CAColor_blueStyle);
pickerView->setSeparateColor(CAColor_blueStyle);
pickerView->reloadAllComponents();
this->getView()->addSubview(pickerView);

virtual void reloadComponent(unsigned int component, bool bReload = true)

返回值:void

参数:

类型
参数 说明
unsigned int component 指定的component
bool bReload 可选参数

解释:刷新指定组件


virtual void selectRow(unsigned int row, unsigned int component, bool animated = false)

返回值:void

参数:

类型
参数 说明
unsigned int row 指定的row
unsigned int component 指定的component
bool animated 可选参数

解释:指定选中的row


virtual int selectedRowInComponent(unsigned int component)

返回值:int

参数:

类型
参数 说明
unsigned int component 指定的component

解释:获取当前被选中的row


virtual void setBackgroundColor(const CAColor4B& color);    

返回值:void

参数:

类型
参数名 说明
CAColor4B& color 颜色

解释:设置背景颜色


分类导航

关注微信下载离线手册

bootwiki移动版 bootwiki
(群号:472910771)