diff --git a/Doc/API/index.html b/Doc/API/index.html new file mode 100644 index 00000000..ecdb2848 --- /dev/null +++ b/Doc/API/index.html @@ -0,0 +1,279 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ + +

LuaView 跨平台SDK类库API文档

+

支持IOS平台/Android平台

+ +

全局函数

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AlignAlign + 子View在父View中的对齐方式
FontStyleFontStyle + 文字样式
FontWeightFontWeight + 字体粗细类型
SystemSystem + 系统信息获取
TextAlignTextAlign + 文本对齐方式(上下一定居中)
math数学库math
table创建一个表: + local t = {}; -- 脚本中直接两个花括号就生成一个table
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AlertAlert + 弹出系统自带的提示框
Animate动画API
AudioPlayerAudioPlayer + 声音播放器
ButtonButton + 按钮控件
CollectionViewCollectionView + 类似于Cell大小任意的TableView
CustomPanel错误提示框样式 + native可定制
DBDB + 简单的Key Value 字符串值 数据读取/保存
DataData(数据块) + 创建byte数组
DateDate + 日期
DownloaderDownloader + 简单的文件读写
FileFile + 简单的文件读写
ImageImage + 放图片的View
LabelLabel + 放文本的View, 类似安卓的TextView
LoadingIndicator菊花, 活动状体指示器
MtopMtop请求接口
NavigationNavigation + 导航栏菜单控制器
PagerIndicatorPagerIndicator + banner滚动第几页的小圆点
PageViewPageView + 横向分页滚动的View
ScrollViewScrollView + 可滚动的View
StyledString复合文本 + 可以设置字符串的字体/颜色/背景色/前景色
TableViewTableView + 每行高度样式可定制和重复利用的列表
TextFieldTextField + 文本输入框
TimerTimer + 定时器接口
ToastToast + 弹出提示框
Transform3DTransform3D + 用于设置View的3D变换矩阵
ViewView + 所有UI控件的基类
string字符串处理库
+

Topics

+ + + + + +
readme.md
+ +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git a/Doc/API/ldoc.css b/Doc/API/ldoc.css new file mode 100644 index 00000000..7a954f4e --- /dev/null +++ b/Doc/API/ldoc.css @@ -0,0 +1,304 @@ +/* BEGIN RESET + +Copyright (c) 2010, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.com/yui/license.html +version: 2.8.2r1 +*/ +html { + color: #000; + background: #FFF; +} +body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td { + margin: 0; + padding: 0; +} +table { + border-collapse: collapse; + border-spacing: 0; +} +fieldset,img { + border: 0; +} +address,caption,cite,code,dfn,em,strong,th,var,optgroup { + font-style: inherit; + font-weight: inherit; +} +del,ins { + text-decoration: none; +} +li { + list-style: disc; + margin-left: 20px; +} +caption,th { + text-align: left; +} +h1,h2,h3,h4,h5,h6 { + font-size: 100%; + font-weight: bold; +} +q:before,q:after { + content: ''; +} +abbr,acronym { + border: 0; + font-variant: normal; +} +sup { + vertical-align: baseline; +} +sub { + vertical-align: baseline; +} +legend { + color: #000; +} +input,button,textarea,select,optgroup,option { + font-family: inherit; + font-size: inherit; + font-style: inherit; + font-weight: inherit; +} +input,button,textarea,select {*font-size:100%; +} +/* END RESET */ + +body { + margin-left: 1em; + margin-right: 1em; + font-family: arial, helvetica, geneva, sans-serif; + background-color: #ffffff; margin: 0px; +} + +code, tt { font-family: monospace; font-size: 1.1em; } +span.parameter { font-family:monospace; } +span.parameter:after { content:":"; } +span.types:before { content:"("; } +span.types:after { content:")"; } +.type { font-weight: bold; font-style:italic } + +body, p, td, th { font-size: .95em; line-height: 1.2em;} + +p, ul { margin: 10px 0 0 0px;} + +strong { font-weight: bold;} + +em { font-style: italic;} + +h1 { + font-size: 1.5em; + margin: 20px 0 20px 0; +} +h2, h3, h4 { margin: 15px 0 10px 0; } +h2 { font-size: 1.25em; } +h3 { font-size: 1.15em; } +h4 { font-size: 1.06em; } + +a:link { font-weight: bold; color: #004080; text-decoration: none; } +a:visited { font-weight: bold; color: #006699; text-decoration: none; } +a:link:hover { text-decoration: underline; } + +hr { + color:#cccccc; + background: #00007f; + height: 1px; +} + +blockquote { margin-left: 3em; } + +ul { list-style-type: disc; } + +p.name { + font-family: "Andale Mono", monospace; + padding-top: 1em; +} + +pre { + background-color: rgb(245, 245, 245); + border: 1px solid #C0C0C0; /* silver */ + padding: 10px; + margin: 10px 0 10px 0; + overflow: auto; + font-family: "Andale Mono", monospace; +} + +pre.example { + font-size: .85em; +} + +table.index { border: 1px #00007f; } +table.index td { text-align: left; vertical-align: top; } + +#container { + margin-left: 1em; + margin-right: 1em; + background-color: #f0f0f0; +} + +#product { + text-align: center; + border-bottom: 1px solid #cccccc; + background-color: #ffffff; +} + +#product big { + font-size: 2em; +} + +#main { + background-color: #f0f0f0; + border-left: 2px solid #cccccc; +} + +#navigation { + float: left; + width: 14em; + vertical-align: top; + background-color: #f0f0f0; + overflow: visible; +} + +#navigation h2 { + background-color:#e7e7e7; + font-size:1.1em; + color:#000000; + text-align: left; + padding:0.2em; + border-top:1px solid #dddddd; + border-bottom:1px solid #dddddd; +} + +#navigation ul +{ + font-size:1em; + list-style-type: none; + margin: 1px 1px 10px 1px; +} + +#navigation li { + text-indent: -1em; + display: block; + margin: 3px 0px 0px 22px; +} + +#navigation li li a { + margin: 0px 3px 0px -1em; +} + +#content { + margin-left: 14em; + padding: 1em; + width: 700px; + border-left: 2px solid #cccccc; + border-right: 2px solid #cccccc; + background-color: #ffffff; +} + +#about { + clear: both; + padding: 5px; + border-top: 2px solid #cccccc; + background-color: #ffffff; +} + +@media print { + body { + font: 12pt "Times New Roman", "TimeNR", Times, serif; + } + a { font-weight: bold; color: #004080; text-decoration: underline; } + + #main { + background-color: #ffffff; + border-left: 0px; + } + + #container { + margin-left: 2%; + margin-right: 2%; + background-color: #ffffff; + } + + #content { + padding: 1em; + background-color: #ffffff; + } + + #navigation { + display: none; + } + pre.example { + font-family: "Andale Mono", monospace; + font-size: 10pt; + page-break-inside: avoid; + } +} + +table.module_list { + border-width: 1px; + border-style: solid; + border-color: #cccccc; + border-collapse: collapse; +} +table.module_list td { + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #cccccc; +} +table.module_list td.name { background-color: #f0f0f0; min-width: 200px; } +table.module_list td.summary { width: 100%; } + + +table.function_list { + border-width: 1px; + border-style: solid; + border-color: #cccccc; + border-collapse: collapse; +} +table.function_list td { + border-width: 1px; + padding: 3px; + border-style: solid; + border-color: #cccccc; +} +table.function_list td.name { background-color: #f0f0f0; min-width: 200px; } +table.function_list td.summary { width: 100%; } + +ul.nowrap { + overflow:auto; + white-space:nowrap; +} + +dl.table dt, dl.function dt {border-top: 1px solid #ccc; padding-top: 1em;} +dl.table dd, dl.function dd {padding-bottom: 1em; margin: 10px 0 0 20px;} +dl.table h3, dl.function h3 {font-size: .95em;} + +/* stop sublists from having initial vertical space */ +ul ul { margin-top: 0px; } +ol ul { margin-top: 0px; } +ol ol { margin-top: 0px; } +ul ol { margin-top: 0px; } + +/* make the target distinct; helps when we're navigating to a function */ +a:target + * { + background-color: #FF9; +} + + +/* styles for prettification of source */ +pre .comment { color: #558817; } +pre .constant { color: #a8660d; } +pre .escape { color: #844631; } +pre .keyword { color: #aa5050; font-weight: bold; } +pre .library { color: #0e7c6b; } +pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; } +pre .string { color: #8080ff; } +pre .number { color: #f8660d; } +pre .operator { color: #2239a8; font-weight: bold; } +pre .preprocessor, pre .prepro { color: #a33243; } +pre .global { color: #800080; } +pre .user-keyword { color: #800080; } +pre .prompt { color: #558817; } +pre .url { color: #272fc2; text-decoration: underline; } + diff --git a/Doc/API/topics/readme.md.html b/Doc/API/topics/readme.md.html new file mode 100644 index 00000000..c7f28369 --- /dev/null +++ b/Doc/API/topics/readme.md.html @@ -0,0 +1,213 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ + + +

LuaView SDK 文档

+ +

+

Introduction

+ +

LDoc is a software documentation tool which automatically generates API documentation +out of source code comments (doc comments). It is mainly targeted at Lua and documenting +Lua APIs, but it can also parse C with according doc comments for documenting Lua modules +implemented in C.

+ +

It is mostly compatible with LuaDoc, +except that certain workarounds are no longer needed. +For instance, it is not so married to the idea that Lua modules should be defined using the +module function; this is not only a matter of taste since this has been deprecated in Lua +5.2.

+ + +

Although there are a fair number of command-line options, the preferred route is to write a +config.ld configuration file in Lua format. By convention, if LDoc is simply invoked as +ldoc . it will read this file first. In this way, the aim is to make it very easy for +end-users to build your documentation using this simple command.

+ +

+

Commenting Conventions

+ +

LDoc follows the conventions established by Javadoc and later by LuaDoc to document the +modules, functions, tables and types ("classes") of your API.

+ +

Doc comments

+ +

Only 'doc comments' are parsed; these can be started with at least 3 hyphens, or by a empty +comment line with at least 3 hypens:

+ + +
+--- summary.
+-- Description; this can extend over
+-- several lines
+
+-----------------
+-- This will also do.
+
+
+ +

Any module or script must start with a doc comment; any other files are ignored and a +warning issued. The only exception is if the module starts with an explicit module +statement.

+ +

If your coding standards require a boilerplate copyright notice, then the -B flag or +boilerplate=true will make LDoc ignore the first comment of each module.

+ +

Common commenting patterns like '---- (text) -----' are exempted, since they are often used +for programmer-facing documentation.

+ + +

Tags

+ +

All doc comments start with a summary sentence, that ends with a period or a question mark. +An optional description may follow. Normally the summary sentence will appear in the module +contents.

+ +

After this descriptive text, there will typically be tags which are introduced with an @. +These follow the convention established by Javadoc and widely used in tools for other languages.

+ + +
+--- Some doc comment
+-- @tag1 parameters for first tag
+-- @tag2 parameters for the second tag
+
+
+ +

The order of tags is not important, but as always, consistency is useful.

+ +

Here are all the tags known to LDoc:

+ +
    +
  • @module A Lua module containing functions and tables, which may be inside sections
  • +
  • @classmod Like @module but describing a class
  • +
  • @submodule A file containing definitions that you wish to put into the named master module
  • +
  • @script A Lua program
  • +
  • @author (multiple), copyright, @license, @release only used for project-level tags like @module
  • +
  • @function, @lfunction. Functions inside a module
  • +
  • @param formal arguments of a function (multiple)
  • +
  • @return returned values of a function (multiple)
  • +
  • @raise unhandled error thrown by this function
  • +
  • @local explicitly marks a function as not being exported (unless --all)
  • +
  • @see reference other documented items
  • +
  • @usage give an example of a function's use. (Has a somewhat different meaning when used + with @module)
  • +
  • @table a Lua table
  • +
  • @field a named member of a table
  • +
  • @section starting a named section for grouping functions or tables together
  • +
  • @type a section which describes a class
  • +
  • @within puts the function or table into an implicit section
  • +
  • @fixme, @todo and @warning are annotations, which are doc comments that + occur inside a function body.
  • +
+ +

The first important tag to know is the module tag:

+ +

However, you must either use the --colon flag or set colon=true in your config.ld.

+ +

In this style, types may be used directly if prefixed with '!' or '?' (for type-or-nil)

+ +

(see View, rendered here)

+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/Align.html" "b/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/Align.html" new file mode 100644 index 00000000..f6d16930 --- /dev/null +++ "b/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/Align.html" @@ -0,0 +1,250 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Module Align

+

Align + 子View在父View中的对齐方式

+

+ +

+ + +

Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Align.TOP垂直对齐方式(向上)
Align.LEFT水平对齐方式(靠左)
Align.BOTTOM垂直对齐方式(向下)
Align.RIGHT水平对齐方式(靠右)
Align.H_CENTER水平对齐方式(居中)
Align.V_CETNER垂直对齐方式(居中)
Align.CENTER水平垂直对齐方式都居中
+ +
+
+ + +

Fields

+ +
+
+ + Align.TOP +
+
+ 垂直对齐方式(向上) + + + + + + + +
+
+ + Align.LEFT +
+
+ 水平对齐方式(靠左) + + + + + + + +
+
+ + Align.BOTTOM +
+
+ 垂直对齐方式(向下) + + + + + + + +
+
+ + Align.RIGHT +
+
+ 水平对齐方式(靠右) + + + + + + + +
+
+ + Align.H_CENTER +
+
+ 水平对齐方式(居中) + + + + + + + +
+
+ + Align.V_CETNER +
+
+ 垂直对齐方式(居中) + + + + + + + +
+
+ + Align.CENTER +
+
+ 水平垂直对齐方式都居中 + + + + + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/FontStyle.html" "b/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/FontStyle.html" new file mode 100644 index 00000000..e3347bef --- /dev/null +++ "b/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/FontStyle.html" @@ -0,0 +1,178 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Module FontStyle

+

FontStyle + 文字样式

+

+ +

+ + +

Fields

+ + + + + + + + + + + + + +
FontStyle.NORMAL正常字体
FontStyle.ITALIC斜体
FontStyle.OBLIQUE倾斜文字
+ +
+
+ + +

Fields

+ +
+
+ + FontStyle.NORMAL +
+
+ 正常字体 + + + + + + + +
+
+ + FontStyle.ITALIC +
+
+ 斜体 + + + + + + + +
+
+ + FontStyle.OBLIQUE +
+
+ 倾斜文字 + + + + + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/FontWeight.html" "b/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/FontWeight.html" new file mode 100644 index 00000000..6e4a2bda --- /dev/null +++ "b/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/FontWeight.html" @@ -0,0 +1,160 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Module FontWeight

+

FontWeight + 字体粗细类型

+

+ +

+ + +

Fields

+ + + + + + + + + +
FontWeight.NORMAL默认粗细字体
FontWeight.BOLD粗体
+ +
+
+ + +

Fields

+ +
+
+ + FontWeight.NORMAL +
+
+ 默认粗细字体 + + + + + + + +
+
+ + FontWeight.BOLD +
+
+ 粗体 + + + + + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/System.html" "b/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/System.html" new file mode 100644 index 00000000..dabc3bcc --- /dev/null +++ "b/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/System.html" @@ -0,0 +1,337 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Module System

+

System + 系统信息获取

+

+ +

+ + +

全局函数

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
System.ios ()ios 系统返回true/否则返回nil(false)
System.android ()android 系统返回true/否则返回nil(false)
System.vmVersion ()获取虚拟机版本号
System.osVersion ()获取手机操作系统版本号
System.platform ()获取平台信息
System.scale ()获取屏幕分辨率
System.device ()获取设备信息
System.screenSize ()获取屏幕尺寸
System.gc ()强制虚拟机内存回收
+ +
+
+ + +

全局函数

+ +
+
+ + System.ios () +
+
+ ios 系统返回true/否则返回nil(false) + + + +

返回值:

+
    + + bool + 是否 +
+ + + + +
+
+ + System.android () +
+
+ android 系统返回true/否则返回nil(false) + + + +

返回值:

+
    + + bool + 是否 +
+ + + + +
+
+ + System.vmVersion () +
+
+ 获取虚拟机版本号 + + + +

返回值:

+
    + + string + 虚拟机版本号 +
+ + + + +
+
+ + System.osVersion () +
+
+ 获取手机操作系统版本号 + + + +

返回值:

+
    + + string + 手机操作系统版本号 +
+ + + + +
+
+ + System.platform () +
+
+ 获取平台信息 + + + +

返回值:

+
    + + string + 平台信息 +
+ + + + +
+
+ + System.scale () +
+
+ 获取屏幕分辨率 + + + +

返回值:

+
    + + number + 分辨率 +
+ + + + +
+
+ + System.device () +
+
+ 获取设备信息 + + + +

返回值:

+
    + + string + 设备名 iphone / ipad / ipod +
+ + + + +
+
+ + System.screenSize () +
+
+ 获取屏幕尺寸 + + + +

返回值:

+
    +
  1. + number + w 宽
  2. +
  3. + number + h 高
  4. +
+ + + + +
+
+ + System.gc () +
+
+ 强制虚拟机内存回收 + + + + + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/TextAlign.html" "b/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/TextAlign.html" new file mode 100644 index 00000000..1c4a8a68 --- /dev/null +++ "b/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/TextAlign.html" @@ -0,0 +1,178 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Module TextAlign

+

TextAlign + 文本对齐方式(上下一定居中)

+

+ +

+ + +

Fields

+ + + + + + + + + + + + + +
TextAlign.LEFT水平对齐方式(靠左)
TextAlign.RIGHT水平对齐方式(靠右)
TextAlign.CENTER水平对齐方式(居中)
+ +
+
+ + +

Fields

+ +
+
+ + TextAlign.LEFT +
+
+ 水平对齐方式(靠左) + + + + + + + +
+
+ + TextAlign.RIGHT +
+
+ 水平对齐方式(靠右) + + + + + + + +
+
+ + TextAlign.CENTER +
+
+ 水平对齐方式(居中) + + + + + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/math.html" "b/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/math.html" new file mode 100644 index 00000000..fa663ce3 --- /dev/null +++ "b/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/math.html" @@ -0,0 +1,855 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Module math

+

数学库math

+

+ +

+ + +

全局函数

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
math:abs ()绝对值
math:acos ()反余弦函数
math:asin ()反正弦函数
math:atan2 (y, x)反正切值(y,x)
math:atan (x, y)反正切值(x,y)
math:ceil (number)返回大于或者等于指定表达式的最小整数
math:cosh (number, number)双曲余弦值
math:cos (number)余弦
math:deg (number)弧度 转 角度
math:rad (number)角度 转 弧度
math:exp (number)高等数学里以自然常数e为底的指数函数,它又是航模名词,全称Exponential(指数曲线)
math:floor (number)返回比参数小的最大整数
math:fmod (x, y)计算x对y的模,即x/y的求余运算 (参见百科词条mod中的“求余函数” 条目),若y是0,则返回NaN。
math:frexp (x)把一个浮点数分解为尾数和指数 + 其中 x = 尾数 * 2^指数
math:ldexp (value, exp)计算value乘以2的exp次幂 ( value * ( 2^exp ) )
math:log10 (x)以10为底的对数函数
math:log (x)计算以e为底的对数值
math:max ()最大值(支持多个参数)
math:min ()最小值(支持多个参数)
math:modf (x)分解x,以得到x的整数和小数部分
math:pow (x, y)计算x的y次幂
math:random (min, max)获取随机数
math:randomseed ()设置随机发生器的种子
math:sinh ()双曲正弦函数
math:sin ()正弦函数
math:sqrt ()开平方根
math:tanh ()双曲正切
math:tan ()正切函数
+ +
+
+ + +

全局函数

+ +
+
+ + math:abs () +
+
+ 绝对值 + + + + + + +

例子:

+
    +
    local t = -3;
    + t = math:abs( t );
    +
+ +
+
+ + math:acos () +
+
+ 反余弦函数 + + + + + + + +
+
+ + math:asin () +
+
+ 反正弦函数 + + + + + + + +
+
+ + math:atan2 (y, x) +
+
+ 反正切值(y,x) + + +

参数:

+
    +
  • y + number + + + +
  • +
  • x + number + + + +
  • +
+ + + + + +
+
+ + math:atan (x, y) +
+
+ 反正切值(x,y) + + +

参数:

+
    +
  • x + number + + + +
  • +
  • y + number + + + +
  • +
+ + + + + +
+
+ + math:ceil (number) +
+
+ 返回大于或者等于指定表达式的最小整数 + + +

参数:

+
    +
  • number + number + + + +
  • +
+ + + + + +
+
+ + math:cosh (number, number) +
+
+ 双曲余弦值 + + +

参数:

+
    +
  • number + number + + + +
  • +
  • number + number + + + +
  • +
+ + + + + +
+
+ + math:cos (number) +
+
+ 余弦 + + +

参数:

+
    +
  • number + number + + + +
  • +
+ + + + + +
+
+ + math:deg (number) +
+
+ 弧度 转 角度 + + +

参数:

+
    +
  • number + number + + + +
  • +
+ + + + + +
+
+ + math:rad (number) +
+
+ 角度 转 弧度 + + +

参数:

+
    +
  • number + number + + + +
  • +
+ + + + + +
+
+ + math:exp (number) +
+
+ 高等数学里以自然常数e为底的指数函数,它又是航模名词,全称Exponential(指数曲线) + + +

参数:

+
    +
  • number + number + + + +
  • +
+ + + + + +
+
+ + math:floor (number) +
+
+ 返回比参数小的最大整数 + + +

参数:

+
    +
  • number + number + + + +
  • +
+ + + + + +
+
+ + math:fmod (x, y) +
+
+ 计算x对y的模,即x/y的求余运算 (参见百科词条mod中的“求余函数” 条目),若y是0,则返回NaN。 + + +

参数:

+
    +
  • x + number + + + +
  • +
  • y + number + + + +
  • +
+ + + + + +
+
+ + math:frexp (x) +
+
+ 把一个浮点数分解为尾数和指数 + 其中 x = 尾数 * 2^指数 + + +

参数:

+
    +
  • x + number + + + +
  • +
+ + + + + +
+
+ + math:ldexp (value, exp) +
+
+ 计算value乘以2的exp次幂 ( value * ( 2^exp ) ) + + +

参数:

+
    +
  • value + number + + + +
  • +
  • exp + number + + + +
  • +
+ +

返回值:

+
    + + number + 计算结果 +
+ + + + +
+
+ + math:log10 (x) +
+
+ 以10为底的对数函数 + + +

参数:

+
    +
  • x + number + + + +
  • +
+ + + + + +
+
+ + math:log (x) +
+
+ 计算以e为底的对数值 + + +

参数:

+
    +
  • x + number + + + +
  • +
+ +

返回值:

+
    + + 以e为底的对数值 + + + +
+ + + + +
+
+ + math:max () +
+
+ 最大值(支持多个参数) + + + +

返回值:

+
    + + number + 返回最大值 +
+ + + + +
+
+ + math:min () +
+
+ 最小值(支持多个参数) + + + +

返回值:

+
    + + number + 返回最小值 +
+ + + + +
+
+ + math:modf (x) +
+
+ 分解x,以得到x的整数和小数部分 + + +

参数:

+
    +
  • x + number + 数值 +
  • +
+ + + + + +
+
+ + math:pow (x, y) +
+
+ 计算x的y次幂 + + +

参数:

+
    +
  • x + number + + + +
  • +
  • y + number + + + +
  • +
+ + + + + +
+
+ + math:random (min, max) +
+
+ 获取随机数 + + +

参数:

+
    +
  • min + number + 最小值(可选) +
  • +
  • max + number + 最大值(可选) +
  • +
+ +

返回值:

+
    + + number + 随机数 +
+ + + + +
+
+ + math:randomseed () +
+
+ 设置随机发生器的种子 + + + + + + + +
+
+ + math:sinh () +
+
+ 双曲正弦函数 + + + + + + + +
+
+ + math:sin () +
+
+ 正弦函数 + + + + + + + +
+
+ + math:sqrt () +
+
+ 开平方根 + + + + + + + +
+
+ + math:tanh () +
+
+ 双曲正切 + + + + + + + +
+
+ + math:tan () +
+
+ 正切函数 + + + + + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/table.html" "b/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/table.html" new file mode 100644 index 00000000..1c8d0ea2 --- /dev/null +++ "b/Doc/API/\345\205\250\345\261\200\345\207\275\346\225\260/table.html" @@ -0,0 +1,585 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Module table

+

创建一个表: + local t = {}; -- 脚本中直接两个花括号就生成一个table

+

+ +

+ + +

全局函数

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ipairs (table)key值1开始顺序 遍历函数
pairs (table)遍历table的所有键值对
table:concat (table)连接表格的所有元素
table:foreachi (table, function)会期望一个从 1(数字 1)开始的连续整数范围,遍历table中的key和value逐对进行function(i, v)操作
table:foreach (table, function)与foreachi不同的是,foreach会对整个表进行迭代
table:getn (table, num)返回table中元素的个数
table:maxn (table)table:maxn()函数返回指定table中所有正数key值中最大的key值.
table:insert (table, pos)table:insert()函数在table的数组部分指定位置(pos)插入值为value的一个元素.
table:remove (table, pos)删除并返回table数组部分位于pos位置的元素.
table:setn (table, num)设置table中的元素个数
table:sort (table, comp)函数对给定的table进行升序排序.
+ +
+
+ + +

全局函数

+ +
+
+ + ipairs (table) +
+
+ key值1开始顺序 遍历函数 + + +

参数:

+
    +
  • table + table + 表 +
  • +
+ + + + +

例子:

+
    +
    + local tabFiles = {
    +     [1] = "test2",
    +     [6] = "test3",
    +     [4] = "test1"
    + }
    +
    + for k, v in ipairs(tabFiles) do
    +     print(k, v)
    + end
    + -- 只输出第一个元素
    +    
    +
+ +
+
+ + pairs (table) +
+
+ 遍历table的所有键值对 + + +

参数:

+
    +
  • table + table + 表 +
  • +
+ + + + +

例子:

+
    +
    + local tabFiles = {
    +     [1] = "test2",
    +     [6] = "test3",
    +     [4] = "test1"
    + }
    +
    + for k, v in ipairs(tabFiles) do
    +     print(k, v)
    + end
    + -- 输出所有元素
    +  
    +
+ +
+
+ + table:concat (table) +
+
+ 连接表格的所有元素 + + +

参数:

+
    +
  • table + table + 表 +
  • +
+ + + + +

例子:

+
    +
    + local t = {"alpha", "beta", "gamma"}
    + print(table:concat(t,":"))
    + print(table:concat(t, nil, 1, 2))
    + print(table:concat(t, "\n", 2, 3))
    +
+ +
+
+ + table:foreachi (table, function) +
+
+ 会期望一个从 1(数字 1)开始的连续整数范围,遍历table中的key和value逐对进行function(i, v)操作 + + +

参数:

+
    +
  • table + table + 表 +
  • +
  • function + function + + + +
  • +
+ + + + +

例子:

+
    +
    + t1 = {2, 4, 6, language="Lua", version="5", 8, 10, 12, web="hello lua"};
    + table:foreachi(t1, function(i, v) print (i, v) end) ; --等价于foreachi(t1, print)
    + -- 输出结果
    + -- 1 2
    + -- 2 4
    + -- 3 6
    + -- 4 8
    + -- 5 10
    + -- 6 12
    +    
    +
+ +
+
+ + table:foreach (table, function) +
+
+ 与foreachi不同的是,foreach会对整个表进行迭代 + + +

参数:

+
    +
  • table + table + 表 +
  • +
  • function + function + (i,v) +
  • +
+ + + + +

例子:

+
    +
    + t1 = { 2, 4, 6, language="Lua", version="5", 8, 10, 12, web="hello lua" };
    + table:foreach(t1,
    +     function(i, v)
    +         print (i, v)
    +     end
    +     ) ;
    + -- 1 2
    + -- 2 4
    + -- 3 6
    + -- 4 8
    + -- 5 10
    + -- 6 12
    + -- web hello lua
    + -- language Lua
    + -- version 5
    +  
    +
+ +
+
+ + table:getn (table, num) +
+
+ 返回table中元素的个数 + + +

参数:

+
    +
  • table + table + 表 +
  • +
  • num + int + + + +
  • +
+ + + + + +
+
+ + table:maxn (table) +
+
+ table:maxn()函数返回指定table中所有正数key值中最大的key值. 如果不存在key值为正数的元素, 则返回0. 此函数不限于table的数组部分. + + +

参数:

+
    +
  • table + table + 表 +
  • +
+ + + + +

例子:

+
    +
    + local tbl = {[1] = "a", [2] = "b", [3] = "c", [26] = "z"}
    + print(#tbl)
    + --3               -- 因为26和之前的数字不连续, 所以不算在数组部分内
    + print(table:maxn(tbl))
    + --26
    + tbl[91.32] = true
    + print(table:maxn(tbl))
    + --91.32
    +   
    +
+ +
+
+ + table:insert (table, pos) +
+
+ table:insert()函数在table的数组部分指定位置(pos)插入值为value的一个元素. pos参数可选, 默认为数组部分末尾. + + +

参数:

+
    +
  • table + table + 表 +
  • +
  • pos + int + 位置 +
  • +
+ + + + +

例子:

+
    +
    + local tbl = {"alpha", "beta", "gamma"}
    + table:insert(tbl, "delta")
    + table:insert(tbl, "epsilon")
    + print(table:concat(tbl, ", ")
    + --alpha, beta, gamma, delta, epsilon
    + table:insert(tbl, 3, "zeta")
    + print(table:concat(tbl, ", ")
    + --alpha, beta, zeta, gamma, delta, epsilon
    +  
    +
+ +
+
+ + table:remove (table, pos) +
+
+ 删除并返回table数组部分位于pos位置的元素. 其后的元素会被前移. pos参数可选, 默认为table长度, 即从最后一个元素删起. + + +

参数:

+
    +
  • table + table + 表 +
  • +
  • pos + int + 元素位置 +
  • +
+ + + + + +
+
+ + table:setn (table, num) +
+
+ 设置table中的元素个数 + + +

参数:

+
    +
  • table + table + 表 +
  • +
  • num + int + + + +
  • +
+ + + + + +
+
+ + table:sort (table, comp) +
+
+ 函数对给定的table进行升序排序. + + +

参数:

+
    +
  • table + table + 表 +
  • +
  • comp + function + 表 +
  • +
+ + + + +

例子:

+
    +
  • + tbl = {"alpha", "beta", "gamma", "delta"}
    + table:sort(tbl)
    + print(table:concat(tbl, ", "))
    + -- alpha, beta, delta, gamma
  • +
  • + -- comp是一个可选的参数, 此参数是一个外部函数, 可以用来自定义sort函数的排序标准.
    + -- 此函数应满足以下条件: 接受两个参数(依次为a, b), 并返回一个布尔型的值, 当a应该排在b前面时, 返回true, 反之返回false.
    + -- 例如, 当我们需要降序排序时, 可以这样写:
    + sortFunc = function(a, b) return b < a end
    + table:sort(tbl, sortFunc)
    + print(table:concat(tbl, ", "))
    + -- gamma, delta, beta, alpha
    +    
  • +
  • + guild = {}
    + table:insert(guild, {
    +    name = "Cladhaire",
    +    class = "Rogue",
    +    level = 70,
    + })
    + table:insert(guild, {
    +    name = "Sagart",
    +    class = "Priest",
    +    level = 70,
    + })
    + table:insert(guild, {
    +    name = "Mallaithe",
    +    class = "Warlock",
    +    level = 40,
    + })
    + -- 对这个table进行排序时, 应用以下的规则: 按等级升序排序, 在等级相同时, 按姓名升序排序.
    + -- 可以写出这样的排序函数:
    +
    + function sortLevelNameAsc(a, b)
    +    if a.level == b.level then
    +       return a.name < b.name
    +    else
    +       return a.level < b.level
    +    end
    + end
    +
    + -- 测试功能如下:
    + table:sort(guild, sortLevelNameAsc)
    + for idx, value in ipairs(guild) do
    +     print(idx, value.name)
    + end
    + -- 1, Mallaithe
    + -- 2, Cladhaire
    + -- 3, Sagart
    +   
  • +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/Alert.html" "b/Doc/API/\347\261\273/Alert.html" new file mode 100644 index 00000000..1e2189d4 --- /dev/null +++ "b/Doc/API/\347\261\273/Alert.html" @@ -0,0 +1,161 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class Alert

+

Alert + 弹出系统自带的提示框

+

+ +

+ + +

全局函数

+ + + + + +
Alert ()弹出一个提示框
+ +
+
+ + +

全局函数

+ +
+
+ + Alert () +
+
+ 弹出一个提示框 + + + +

返回值:

+
    + + Alert + view +
+ + + +

例子:

+
    +
    + Alert("标题", "内容",
    +                "确定","取消", -- 按钮个数支持0~10个
    +                 ^(index){
    +                        print("按钮ID:",index)
    +                        if index==0 then
    +                            window.release();
    +                        end
    +                 }
    +            );
    +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/Animate.html" "b/Doc/API/\347\261\273/Animate.html" new file mode 100644 index 00000000..cfb7631e --- /dev/null +++ "b/Doc/API/\347\261\273/Animate.html" @@ -0,0 +1,386 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class Animate

+

动画API

+

+ +

+ + +

全局函数

+ + + + + + + + + + + + + + + + + + + + + +
Animate (animations)通过这个方法 设置动画的时间,延时,最终状态,结束回调
Animate (animations, completion)通过这个方法 设置动画的时间,延时,最终状态,结束回调
Animate (duration, animations, completion)通过这个方法 设置动画的时间,延时,最终状态,结束回调
Animate (duration, delay, animations, completion)通过这个方法 设置动画的时间,延时,最终状态,结束回调
Animate (duration, delay, option, animations, completion)通过这个方法 设置动画的时间,延时,最终状态,结束回调
+ +
+
+ + +

全局函数

+ +
+
+ + Animate (animations) +
+
+ 通过这个方法 设置动画的时间,延时,最终状态,结束回调 + + +

参数:

+
    +
  • animations + function + 动画过程回调 --- 该参数是必填参数 +
  • +
+ + + + +

例子:

+
    +
     --例子五
    + local button = Button();
    + button.center(0,0);
    + Animate(
    +     function (){
    +         button.center(100,100);
    +     }
    + );
    +
+ +
+
+ + Animate (animations, completion) +
+
+ 通过这个方法 设置动画的时间,延时,最终状态,结束回调 + + +

参数:

+
    +
  • animations + function + 动画过程回调 --- 该参数是必填参数 +
  • +
  • completion + function + 动画结束回调 --- 该参数是可选的 默认值是nil +
  • +
+ + + + +

例子:

+
    +
     --例子四
    + local button = Button();
    + button.center(0,0);
    + Animate(
    +     function (){
    +         button.center(100,100);
    +     },
    +     function (){
    +         print("动画结束了");
    +     }
    + );
    +
+ +
+
+ + Animate (duration, animations, completion) +
+
+ 通过这个方法 设置动画的时间,延时,最终状态,结束回调 + + +

参数:

+
    +
  • duration + number + 动画耗费时间(单位秒) --- 该参数是可选的 默认值是0.3 +
  • +
  • animations + function + 动画过程回调 --- 该参数是必填参数 +
  • +
  • completion + function + 动画结束回调 --- 该参数是可选的 默认值是nil +
  • +
+ + + + +

例子:

+
    +
     --2. 例子三
    + local button = Button();
    + button.center(0,0);
    + Animate(
    +     1.5, -- 动画时间
    +     function (){
    +         button.center(100,100);
    +     },
    +     function (){
    +         print("动画结束了");
    +     }
    + );
    +
+ +
+
+ + Animate (duration, delay, animations, completion) +
+
+ 通过这个方法 设置动画的时间,延时,最终状态,结束回调 + + +

参数:

+
    +
  • duration + number + 动画耗费时间(单位秒) --- 该参数是可选的 默认值是0.3 +
  • +
  • delay + number + 动画延时多少时间后启动(单位秒) --- 该参数是可选的 默认值是0 +
  • +
  • animations + function + 动画过程回调 --- 该参数是必填参数 +
  • +
  • completion + function + 动画结束回调 --- 该参数是可选的 默认值是nil +
  • +
+ + + + +

例子:

+
    +
     --2. 例子二(更多参数)
    + local button = Button();
    + button.center(0,0);
    + Animate(
    +     1.5, -- 动画时间
    +     2, -- 动画延时
    +     function (){
    +         button.center(100,100);
    +     },
    +     function (){
    +         print("动画结束了");
    +     }
    + );
    +
+ +
+
+ + Animate (duration, delay, option, animations, completion) +
+
+ 通过这个方法 设置动画的时间,延时,最终状态,结束回调 + + +

参数:

+
    +
  • duration + number + 动画耗费时间(单位秒) --- 该参数是可选的 默认值是0.3 +
  • +
  • delay + number + 动画延时多少时间后启动(单位秒) --- 该参数是可选的 默认值是0 +
  • +
  • option + number + AnimationOptions参数 --- 该参数是可选的 默认值是0 +
  • +
  • animations + function + 动画过程回调 --- 该参数是必填参数 +
  • +
  • completion + function + 动画结束回调 --- 该参数是可选的 默认值是nil +
  • +
+ + + + +

例子:

+
    +
  •  -- 例子一
    + local button = Button();
    + button.center(0,0);
    + Animate(
    +     1.5, -- 动画时间
    +     2, -- 动画延时
    +     0, -- 动画参数
    +     function (){
    +         button.center(100,100);
    +     },
    +     function (){
    +         print("动画结束了");
    +     }
    + );
  • +
  • + options 对应的 AnimationOptions 参数列表
    + UIViewAnimationOptionLayoutSubviews            = 1,
    + UIViewAnimationOptionAllowUserInteraction      = 2, -- turn on user interaction while animating
    + UIViewAnimationOptionBeginFromCurrentState     = 4, -- start all views from current value, not initial value
    + UIViewAnimationOptionRepeat                    = 8, -- repeat animation indefinitely
    + UIViewAnimationOptionAutoreverse               = 16, -- if repeat, run animation back and forth
    + UIViewAnimationOptionOverrideInheritedDuration = 32, -- ignore nested duration
    + UIViewAnimationOptionOverrideInheritedCurve    = 64, -- ignore nested curve
    + UIViewAnimationOptionAllowAnimatedContent      = 128, -- animate contents (applies to transitions only)
    + UIViewAnimationOptionShowHideTransitionViews   = 256, -- flip to/from hidden state instead of adding/removing
    + UIViewAnimationOptionOverrideInheritedOptions  = 512, -- do not inherit any options or animation type
    + UIViewAnimationOptionCurveEaseInOut            = 0, -- default
    + UIViewAnimationOptionCurveEaseIn               = 65536,
    + UIViewAnimationOptionCurveEaseOut              = 131072,
    + UIViewAnimationOptionCurveLinear               = 196608,
    + UIViewAnimationOptionTransitionNone            = 0, -- default
    + UIViewAnimationOptionTransitionFlipFromLeft    = 1048576; -- 1 << 20
    + UIViewAnimationOptionTransitionFlipFromRight   = 2097152; -- 2 << 20
    + UIViewAnimationOptionTransitionCurlUp          = 3145728; -- 3 << 20
    + UIViewAnimationOptionTransitionCurlDown        = 4194304; -- 4 << 20
    + UIViewAnimationOptionTransitionCrossDissolve   = 5242880; -- 5 << 20
    + UIViewAnimationOptionTransitionFlipFromTop     = 6291456; -- 6 << 20
    + UIViewAnimationOptionTransitionFlipFromBottom  = 7340032; -- 7 << 20
    + 
  • +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/AttributedString.html" "b/Doc/API/\347\261\273/AttributedString.html" new file mode 100644 index 00000000..6b96acb0 --- /dev/null +++ "b/Doc/API/\347\261\273/AttributedString.html" @@ -0,0 +1,233 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class AttributedString

+

复合文本 + 可以设置字符串的字体/颜色/背景色/前景色

+

+ +

+ + +

全局函数

+ + + + + +
AttributedString (string, table)通过这个方法创建一个AttributedString对象
+

实例方法

+ + + + + +
append ()连接两个AttributedString
+

元方法

+ + + + + +
__add ()连接两个AttributedString
+ +
+
+ + +

全局函数

+ +
+
+ + AttributedString (string, table) +
+
+ 通过这个方法创建一个AttributedString对象 + + +

参数:

+
    +
  • string + string + 文本 +
  • +
  • table + table + 属性表 +
  • +
+ + + + +

例子:

+
    +
     local view = AttributedString();
    + w,h = System.screenSize();
    + window.setFrame(0, 0, w, h);
    +
    + att1 = AttributedString( "123test",  { fontSize=12, fontWeight="bold", foregroundColor=0xff, foregroundColorAlpha=0.9 } );
    + att2 = AttributedString( "测试测试",  { fontSize=30, foregroundColor=0xff0000, backgroundColor=0xff} );
    + att3 = AttributedString( "2897348",  { fontSize=13, foregroundColor=0x777777, strikethroughStyle=1} );
    + att4 = AttributedString( "下划线测试", { fontSize=9, foregroundColor=0x777777, underlineStyle=1} );
    +
    + label = UILabel();
    + label.setFrame(0,30,w, 60);
    + label.setText(att1 + att2 + att3 + att4);
    +      
    +
+ +
+
+

实例方法

+ +
+
+ + append () +
+
+ 连接两个AttributedString + + + + + + +

例子:

+
    +
     local
    + local att1 = AttributedString( "123test",  { fontSize=12, fontWeight="bold", foregroundColor=0xff, foregroundColorAlpha=0.9 } );
    + local att2 = AttributedString( "测试测试",  { fontSize=30, foregroundColor=0xff0000, backgroundColor=0xff} );
    + att1.append(att2);
    +    
    +
+ +
+
+

元方法

+ +
+
+ + __add () +
+
+ 连接两个AttributedString + + + + + + +

例子:

+
    +
     local
    + local att1 = AttributedString( "123test",  { fontSize=12, fontWeight="bold", foregroundColor=0xff, foregroundColorAlpha=0.9 } );
    + local att2 = AttributedString( "测试测试",  { fontSize=30, foregroundColor=0xff0000, backgroundColor=0xff} );
    + local att3 = att1 + att2;
    +      
    +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/AudioPlayer.html" "b/Doc/API/\347\261\273/AudioPlayer.html" new file mode 100644 index 00000000..c8387f97 --- /dev/null +++ "b/Doc/API/\347\261\273/AudioPlayer.html" @@ -0,0 +1,199 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class AudioPlayer

+

AudioPlayer + 声音播放器

+

+ +

+ + +

全局函数

+ + + + + +
AudioPlayer (url)创建声音播放器
+

实例方法

+ + + + + + + + + +
play ()开始播放
stop ()停止播放
+ +
+
+ + +

全局函数

+ +
+
+ + AudioPlayer (url) +
+
+ 创建声音播放器 + + +

参数:

+
    +
  • url + string + 声音资源(支持本地文件和网络资源) +
  • +
+ +

返回值:

+
    + + AudioPlayer + player 播放器 +
+ + + + +
+
+

实例方法

+ +
+
+ + play () +
+
+ 开始播放 + + + + + + + +
+
+ + stop () +
+
+ 停止播放 + + + + + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/Button.html" "b/Doc/API/\347\261\273/Button.html" new file mode 100644 index 00000000..fa21b2e0 --- /dev/null +++ "b/Doc/API/\347\261\273/Button.html" @@ -0,0 +1,487 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class Button

+

Button + 按钮控件

+

Button的父类是View

+ + +

全局函数

+ + + + + +
Button ()通过这个方法可以创建一个Button对象
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
title (title)设置按钮title
title ()获取按钮title
text (title)设置按钮title
text ()获取按钮title
image (normalImage, hightLightImage, disableImage)设置按钮图片
font (fontName, fontSize)设置按钮字体
font ()获取按钮title字体
titleColor (titleColor, alpha)设置按钮title颜色
titleColor ()获取按钮title颜色
enabled (enabled)设置按钮是否enabled
enabled ()获取按钮是否enabled
callback (callback)设置callback
+ +
+
+ + +

全局函数

+ +
+
+ + Button () +
+
+ 通过这个方法可以创建一个Button对象 + + + +

返回值:

+
    + + button + 按钮 +
+ + + + +
+
+

实例方法

+ +
+
+ + title (title) +
+
+ 设置按钮title + + +

参数:

+
    +
  • title + string + 标题 +
  • +
+ + + + + +
+
+ + title () +
+
+ 获取按钮title + + + + + + + +
+
+ + text (title) +
+
+ 设置按钮title + + +

参数:

+
    +
  • title + string + 标题 +
  • +
+ + + + + +
+
+ + text () +
+
+ 获取按钮title + + + + + + + +
+
+ + image (normalImage, hightLightImage, disableImage) +
+
+ 设置按钮图片 + + +

参数:

+
    +
  • normalImage + string + normal图片样式 +
  • +
  • hightLightImage + string + 高亮图片 (可选) +
  • +
  • disableImage + string + disable的图片 (可选) +
  • +
+ + + + +

例子:

+
    +
    local btn = Button();
    +
+ +
+
+ + font (fontName, fontSize) +
+
+ 设置按钮字体 + + +

参数:

+
    +
  • fontName + string + 可选参数 +
  • +
  • fontSize + number + + + +
  • +
+ + + + +

例子:

+
    +
    local btn = Button();
    +
+ +
+
+ + font () +
+
+ 获取按钮title字体 + + + +

返回值:

+
    +
  1. + string + fontName
  2. +
  3. + number + fontSize
  4. +
+ + + +

例子:

+
    +
    local btn = Button();
    +
+ +
+
+ + titleColor (titleColor, alpha) +
+
+ 设置按钮title颜色 + + +

参数:

+
    +
  • titleColor + int + 颜色值 +
  • +
  • alpha + number + 透明度 +
  • +
+ + + + +

例子:

+
    +
    local btn = Button();
    +
+ +
+
+ + titleColor () +
+
+ 获取按钮title颜色 + + + +

返回值:

+
    +
  1. + int + color 颜色值
  2. +
  3. + number + alpha 透明度
  4. +
+ + + +

例子:

+
    +
    local btn = Button();
    +
+ +
+
+ + enabled (enabled) +
+
+ 设置按钮是否enabled + + +

参数:

+
    +
  • enabled + bool + 是否是能接受触摸事件 +
  • +
+ + + + + +
+
+ + enabled () +
+
+ 获取按钮是否enabled + + + +

返回值:

+
    + + bool + enable +
+ + + + +
+
+ + callback (callback) +
+
+ 设置callback + + +

参数:

+
    +
  • callback + function + 代理方法 +
  • +
+ + + + +

例子:

+
    +
     button.callback( function(){
    +     -- code
    + } );
    +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/CollectionView.html" "b/Doc/API/\347\261\273/CollectionView.html" new file mode 100644 index 00000000..692757b9 --- /dev/null +++ "b/Doc/API/\347\261\273/CollectionView.html" @@ -0,0 +1,321 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class CollectionView

+

CollectionView + 类似于Cell大小任意的TableView

+

CollectionView的父类是ScrollView

+ + +

全局函数

+ + + + + +
CollectionView (dataSource)通过这个方法创建一个CollectionView对象 + 设置Collection代理
+

实例方法

+ + + + + + + + + +
miniSpacing (miniSpacing)设置最小间距
miniSpacing ()获取最小间距
+ +
+
+ + +

全局函数

+ +
+
+ + CollectionView (dataSource) +
+
+ 通过这个方法创建一个CollectionView对象 + 设置Collection代理 + + +

参数:

+
    +
  • dataSource + table + 数据源 +
  • +
+ + + + +

例子:

+
    +
      -- 例子二:
    + local collectionView = CollectionView{
    +         Section = {
    +             SectionCount = 3, -- section 数量
    +
    +             RowCount = ^(section){ -- 每个section对应的行数
    +                 if ( section == 0 ){
    +                     -- 广告栏
    +                     return 0;
    +                 } else if( section==1 ) {
    +                     -- 十点上新提示
    +                     local theBrandMind = getOptionTheBrandMind(i);
    +                     if( theBrandMind ) {
    +                         return 1;
    +                     } else {
    +                         return 0;
    +                     }
    +                 }
    +                 -- 品牌团坑位
    +                 return getOptionItemsNum(i, section);
    +             },
    +             --Spacing = ^(section ){ -- 行间距
    +             --    return 0;
    +             --},
    +             --EdgeInsets = ^(section ){-- cell边距
    +             --   return 0,0,0,0;
    +             --}
    +
    +         },
    +         Cell = {
    +             Id = function ( section, row ){ -- cell唯一标识
    +                 if( section == 0 ) {
    +                     return "广告栏";
    +                 } else if( section == 1 ) {
    +                     return "十点上新";
    +                 } else {
    +                     return "品牌团";
    +                 }
    +             }
    +             "品牌团" = { -- 品牌团cell样式
    +                 Size = ^(section, row){ -- 每个Cell 尺寸
    +                     return scrW , (178 * scrW / 375);
    +                 },
    +                 Init = ^(cell){
    +                    BrandCellInit(cell);
    +                    cell.loading = LoadingIndicator();
    +                 },
    +                 Layout = ^(cell , section, row){
    +                     local model = getOptionModel( i, section, row);
    +                     if ( model ) {
    +                         BrandCellLayout(cell, model );
    +                     }
    +                     cell.loading.startAnimating();
    +                     cell.loading.center(160,50);
    +                 },
    +                 Select = ^(section, row){
    +                     print(section, row);
    +                     System.gc();
    +                 }
    +             },
    +             "十点上新" = { -- 十点上新 cell 样式
    +                 Size = ^(section, row){ -- 每个Cell 尺寸
    +                     return scrW , NOTICE_CELL_H;
    +                 },
    +                 Init = ^(cell){
    +                    local cellW, cellH = window.size();
    +
    +                    cell.line = Label();
    +                    cell.line.frame(0,0,scrW-20,1);
    +                    cell.line.center(cellW/2, cellH/2);
    +                    cell.line.backgroundColor(0x333333);
    +
    +                    cell.label = Label();
    +                    cell.label.frame(0, 0, cellW, cellH);
    +                    cell.label.font(14);
    +                    cell.label.textAlignment(TextAlignmentCenter);
    +                    window.backgroundColor(0xeeeeee);
    +                    cell.label.backgroundColor(0xeeeeee);
    +                 },
    +                 Layout = ^(cell , section, row){
    +                     local cellW, cellH = window.size();
    +                     local theBrandMind = getOptionTheBrandMind(i);
    +                     cell.label.text(theBrandMind );
    +                     cell.label.sizeToFit();
    +                     local w,h = cell.label.size();
    +                     w = w + 20*2;
    +                     cell.label.size(w,h);
    +                     cell.label.center(cellW/2, cellH/2);
    +                 },
    +                 Callback = ^(section, row){
    +                     print(section, row);
    +                     System.gc();
    +                 }
    +             }
    +         },
    +         Callback = {
    +            PullDown = ^(){ -- 开始下拉刷新回调
    +                print("HeaderRefresh");
    +                option.requestItems(^(){
    +                        local collectionView = tableViewArray[i];
    +                        collectionView.reloadData();
    +                        collectionView.headerEndRefreshing();
    +                    });
    +            }
    +		   }
    +     };
    +     collectionView.miniSpacing(5); -- 设置最小间距
    +     local barH = 40;
    +     collectionView.frame( (i-1)*scrW, barH, scrW, scrH-barH);
    +     collectionView.backgroundColor(0xeeeeee);
    +     collectionView.initRefreshHeader();
    +   
    +
+ +
+
+

实例方法

+ +
+
+ + miniSpacing (miniSpacing) +
+
+ 设置最小间距 + + +

参数:

+
    +
  • miniSpacing + number + 最小间距 +
  • +
+ + + + + +
+
+ + miniSpacing () +
+
+ 获取最小间距 + + + +

返回值:

+
    + + number + miniSpacing 最小间距 +
+ + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/CustomPanel.html" "b/Doc/API/\347\261\273/CustomPanel.html" new file mode 100644 index 00000000..f11a69f8 --- /dev/null +++ "b/Doc/API/\347\261\273/CustomPanel.html" @@ -0,0 +1,189 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class CustomPanel

+

错误提示框样式 + native可定制

+

CustomPanel的父类是View

+ + +

全局函数

+ + + + + +
CustomPanel ()通过这个方法创建一个CustomPanel对象
+

实例方法

+ + + + + +
callback (callback)设置callback
+ +
+
+ + +

全局函数

+ +
+
+ + CustomPanel () +
+
+ 通过这个方法创建一个CustomPanel对象 + + + +

返回值:

+
    + + CustomPanel + view +
+ + + +

例子:

+
    +
    local errorView = CustomPanel();
    +
+ +
+
+

实例方法

+ +
+
+ + callback (callback) +
+
+ 设置callback + + +

参数:

+
    +
  • callback + function + 代理方法 +
  • +
+ + + + +

例子:

+
    +
     errorView.callback( function(){
    +     -- code
    + } );
    +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/DB.html" "b/Doc/API/\347\261\273/DB.html" new file mode 100644 index 00000000..146893fa --- /dev/null +++ "b/Doc/API/\347\261\273/DB.html" @@ -0,0 +1,184 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class DB

+

DB + 简单的Key Value 字符串值 数据读取/保存

+

+ +

+ + +

全局函数

+ + + + + + + + + +
DB.get (key)读取数据
DB.set (key, string)保存数据
+ +
+
+ + +

全局函数

+ +
+
+ + DB.get (key) +
+
+ 读取数据 + + +

参数:

+ + +

返回值:

+
    + + string + value +
+ + + + +
+
+ + DB.set (key, string) +
+
+ 保存数据 + + +

参数:

+ + + + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/Data.html" "b/Doc/API/\347\261\273/Data.html" new file mode 100644 index 00000000..52579b2e --- /dev/null +++ "b/Doc/API/\347\261\273/Data.html" @@ -0,0 +1,351 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class Data

+

Data(数据块) + 创建byte数组

+

+ +

+ + +

全局函数

+ + + + + + + + + + + + + +
Data ()创建byte数组
Data (len)创建byte数组
Data (s)创建byte数组
+

实例方法

+ + + + + +
toString ()byte数组按UTF8编码转换成字符串
+

元方法

+ + + + + + + + + + + + + +
__index (index)读取值
__newindex (index)赋值
__add (data)两个数组合并成一个数组
+ +
+
+ + +

全局函数

+ +
+
+ + Data () +
+
+ 创建byte数组 + + + +

返回值:

+
    + + Data + data 数组 +
+ + + + +
+
+ + Data (len) +
+
+ 创建byte数组 + + +

参数:

+
    +
  • len + number + 数组长度 +
  • +
+ +

返回值:

+
    + + Data + data 数组 +
+ + + + +
+
+ + Data (s) +
+
+ 创建byte数组 + + +

参数:

+
    +
  • s + string + 字符串 +
  • +
+ +

返回值:

+
    + + Data + data 数组 +
+ + + + +
+
+

实例方法

+ +
+
+ + toString () +
+
+ byte数组按UTF8编码转换成字符串 + + + +

返回值:

+
    + + string + string 字符串 +
+ + + + +
+
+

元方法

+ +
+
+ + __index (index) +
+
+ 读取值 + + +

参数:

+
    +
  • index + int + 索引号 +
  • +
+ + + + +

例子:

+
    +
    + local data = Data("123456");
    + print(data[2]);
    +
+ +
+
+ + __newindex (index) +
+
+ 赋值 + + +

参数:

+
    +
  • index + int + 索引号 +
  • +
+ + + + +

例子:

+
    +
    + local data = Data("123456");
    + data[2] = 50;
    + print(data[2]);
    +
+ +
+
+ + __add (data) +
+
+ 两个数组合并成一个数组 + + +

参数:

+
    +
  • data + Data + 数组 +
  • +
+ +

返回值:

+
    + + bool + 是否相同 +
+ + + +

例子:

+
    +
    + local data1 = Data('201508271013' );
    + local data2 = Data('测试');
    + print(data1 + data2);
    +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/Date.html" "b/Doc/API/\347\261\273/Date.html" new file mode 100644 index 00000000..38560508 --- /dev/null +++ "b/Doc/API/\347\261\273/Date.html" @@ -0,0 +1,326 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class Date

+

Date + 日期

+

+ +

+ + +

全局函数

+ + + + + + + + + + + + + +
Date ()创建日期对象 当前时间
Date (timeIntervalSince1970)创建日期对象(参数距1970的秒数值)
Date (s, format)创建日期对象(字符串)
+

实例方法

+ + + + + +
timeInterval ()开始播放
+

元方法

+ + + + + + + + + +
__sub (date)时间相减
__eq (date)时间是否相同
+ +
+
+ + +

全局函数

+ +
+
+ + Date () +
+
+ 创建日期对象 当前时间 + + + +

返回值:

+
    + + Date + date 日期 +
+ + + + +
+
+ + Date (timeIntervalSince1970) +
+
+ 创建日期对象(参数距1970的秒数值) + + +

参数:

+
    +
  • timeIntervalSince1970 + number + 秒数 +
  • +
+ +

返回值:

+
    + + Date + date 日期 +
+ + + + +
+
+ + Date (s, format) +
+
+ 创建日期对象(字符串) + + +

参数:

+
    +
  • s + string + 日期字符串 +
  • +
  • format + string + 格式 (可省缺 默认值yyyyMMddHHmmss) +
  • +
+ +

返回值:

+
    + + Date + date 日期 +
+ + + + +
+
+

实例方法

+ +
+
+ + timeInterval () +
+
+ 开始播放 + + + + + + + +
+
+

元方法

+ +
+
+ + __sub (date) +
+
+ 时间相减 + + +

参数:

+
    +
  • date + Date + 日期 +
  • +
+ +

返回值:

+
    + + number + 相差的秒数 +
+ + + +

例子:

+
    +
    + local date1 = Date(20150801093000);
    + local date2 = Date();
    + print(date1 - date2);
    +
+ +
+
+ + __eq (date) +
+
+ 时间是否相同 + + +

参数:

+
    +
  • date + Date + 日期 +
  • +
+ +

返回值:

+
    + + bool + 是否相同 +
+ + + +

例子:

+
    +
    + local date1 = Date(201508271013);
    + local date2 = Date();
    + if ( date1 == date2 ) then
    +     --code
    + end
    +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/Downloader.html" "b/Doc/API/\347\261\273/Downloader.html" new file mode 100644 index 00000000..5551a429 --- /dev/null +++ "b/Doc/API/\347\261\273/Downloader.html" @@ -0,0 +1,205 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class Downloader

+

Downloader + 简单的文件读写

+

+ +

+ + +

全局函数

+ + + + + + + + + +
Downloader.pathOfResource (fileName)获取文件的绝对路径
Downloader.download (url, fileName, function)下载文件
+ +
+
+ + +

全局函数

+ +
+
+ + Downloader.pathOfResource (fileName) +
+
+ 获取文件的绝对路径 + + +

参数:

+
    +
  • fileName + string + 文件名 +
  • +
+ +

返回值:

+
    + + string + 绝对路径 +
+ + + + +
+
+ + Downloader.download (url, fileName, function) +
+
+ 下载文件 + + +

参数:

+
    +
  • url + string + url资源 http://xxxx.xx/xxx +
  • +
  • fileName + string + 本地保存的文件名 +
  • +
  • function + function + (Data) 下载成功后回调 +
  • +
+ + + + +

例子:

+
    +
    + Download("http://g.tbcdn.cn/ju/lua/1.2.0/shake.js","shake.wav",^(data){
    + 	print( data );
    + 	player = AudioPlayer("shake.wav");
    + });
    + button = Button();
    + button.title("播放音效");
    + button.frame(0,100,w,40);
    + button.backgroundColor(0xff,1);
    + button.callback = ^(){
    + 	if( player ) then
    + 		player.play();
    + 	end
    + }
    +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/File.html" "b/Doc/API/\347\261\273/File.html" new file mode 100644 index 00000000..58b37626 --- /dev/null +++ "b/Doc/API/\347\261\273/File.html" @@ -0,0 +1,215 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class File

+

File + 简单的文件读写

+

+ +

+ + +

全局函数

+ + + + + + + + + + + + + +
File.read (fileName)读取数据
File.save (fileName, data)保存数据
File.exist (fileName)检查文件是否存在
+ +
+
+ + +

全局函数

+ +
+
+ + File.read (fileName) +
+
+ 读取数据 + + +

参数:

+
    +
  • fileName + string + 文件名 +
  • +
+ +

返回值:

+
    + + Data + data 数据块 +
+ + + + +
+
+ + File.save (fileName, data) +
+
+ 保存数据 + + +

参数:

+
    +
  • fileName + string + 文件名 +
  • +
  • data + Data + 数据块 +
  • +
+ + + + + +
+
+ + File.exist (fileName) +
+
+ 检查文件是否存在 + + +

参数:

+
    +
  • fileName + string + 文件名 +
  • +
+ +

返回值:

+
    + + bool + exist 是否存在 +
+ + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/Image.html" "b/Doc/API/\347\261\273/Image.html" new file mode 100644 index 00000000..7cc081d0 --- /dev/null +++ "b/Doc/API/\347\261\273/Image.html" @@ -0,0 +1,284 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class Image

+

Image + 放图片的View

+

Image的父类是View

+ + +

全局函数

+ + + + + +
Image ()通过这个方法创建一个Image对象
+

实例方法

+ + + + + + + + + + + + + + + + + +
image (url)设置ImageView的图片url
startAnimation (images, duration, repeatCount)开始帧动画
stopAnimation ()停止帧动画
isAnimating ()是否正在播放帧动画
+ +
+
+ + +

全局函数

+ +
+
+ + Image () +
+
+ 通过这个方法创建一个Image对象 + + + +

返回值:

+
    + + Image + view +
+ + + +

例子:

+
    +
    local view = Image();
    +
+ +
+
+

实例方法

+ +
+
+ + image (url) +
+
+ 设置ImageView的图片url + + +

参数:

+
    +
  • url + string + image url +
  • +
+ + + + +

例子:

+
    +
    local view = Image();
    + view.image("https://gju2.alicdn.com/bao/uploaded/TB25bF4eFXXXXbzXpXXXXXXXXXX_!!0-0-juitemmedia.jpg_560x560Q90.jpg");
    +
+ +
+
+ + startAnimation (images, duration, repeatCount) +
+
+ 开始帧动画 + + +

参数:

+
    +
  • images + array + 帧图片数组 +
  • +
  • duration + number + 动画时间 +
  • +
  • repeatCount + int + 重复次数 +
  • +
+ + + + +

例子:

+
    +
    + w,h = System.screenSize();
    + window.frame(0, 0, w, h);
    + window.enabled(true);
    + window.backgroundColor(0xffffff,1);
    + imageView = Image();
    + imageView.frame(0,30,100,100);
    + imageView.backgroundColor(0xff0000,1);
    + names = {};
    + for i=1,16 do
    + 	  names[i] = "" .. i .. ".tiff"
    + end
    + imageView.image("16.tiff");
    + imageView.startAnimating( names, 3.0, 1);
    +
+ +
+
+ + stopAnimation () +
+
+ 停止帧动画 + + + + + + +

例子:

+
    +
    imageView.stopAnimating();
    +
+ +
+
+ + isAnimating () +
+
+ 是否正在播放帧动画 + + + +

返回值:

+
    + + bool + 是否正在播放帧动画 +
+ + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/Label.html" "b/Doc/API/\347\261\273/Label.html" new file mode 100644 index 00000000..db5ed0a7 --- /dev/null +++ "b/Doc/API/\347\261\273/Label.html" @@ -0,0 +1,447 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class Label

+

Label + 放文本的View, 类似安卓的TextView

+

Label的父类是View

+ + +

全局函数

+ + + + + +
Label ()通过这个全局静态函数 构建一个新的Label对象
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
text (text)设置Label文本信息
text ()获取Label文本
textColor (color, alpha)设置Label文本颜色
textColor ()获取Label文本颜色
font (fontName, fontSize)设置Label字体
font ()获取Label字体
textAlign (align)设置Label文本对齐方式
textAlign ()获取Label文本对齐方式
lineCount (num)设置Label最多行数
lineCount ()获取Label最多行数
adjustFontSize ()让Label字体大小适应宽度, 设置的字体为最大字体, 如果文字超出会缩小字体.
+ +
+
+ + +

全局函数

+ +
+
+ + Label () +
+
+ 通过这个全局静态函数 构建一个新的Label对象 + + + +

返回值:

+
    + + Label + label +
+ + + + +
+
+

实例方法

+ +
+
+ + text (text) +
+
+ 设置Label文本信息 + + +

参数:

+
    +
  • text + string + 文本 +
  • +
+ + + + +

例子:

+
    +
     local label = Label();
    + label.text("测试");
    +      
    +
+ +
+
+ + text () +
+
+ 获取Label文本 + + + +

返回值:

+
    + + string + text 文本 +
+ + + + +
+
+ + textColor (color, alpha) +
+
+ 设置Label文本颜色 + + +

参数:

+
    +
  • color + int + 色值 +
  • +
  • alpha + number + 透明度 +
  • +
+ + + + + +
+
+ + textColor () +
+
+ 获取Label文本颜色 + + + +

返回值:

+
    +
  1. + int + color 色值
  2. +
  3. + number + alpha 透明度
  4. +
+ + + + +
+
+ + font (fontName, fontSize) +
+
+ 设置Label字体 + + +

参数:

+
    +
  • fontName + string + 可选参数 +
  • +
  • fontSize + number + + + +
  • +
+ + + + + +
+
+ + font () +
+
+ 获取Label字体 + + + +

返回值:

+
    +
  1. + string + fontName
  2. +
  3. + number + fontSize
  4. +
+ + + + +
+
+ + textAlign (align) +
+
+ 设置Label文本对齐方式 + + +

参数:

+
    +
  • align + int + 可选参数 +
  • +
+ + + + +

例子:

+
    +
     TextAlignment
    + NSTextAlignmentLeft      = 0,    -- Visually left aligned
    + NSTextAlignmentCenter    = 1,    -- Visually centered
    + NSTextAlignmentRight     = 2,    -- Visually right aligned
    +      
    +
+ +
+
+ + textAlign () +
+
+ 获取Label文本对齐方式 + + + +

返回值:

+
    + + int + align对齐方式 +
+ + + + +
+
+ + lineCount (num) +
+
+ 设置Label最多行数 + + +

参数:

+
    +
  • num + int + 行数 +
  • +
+ + + + + +
+
+ + lineCount () +
+
+ 获取Label最多行数 + + + +

返回值:

+
    + + int + num 行数 +
+ + + + +
+
+ + adjustFontSize () +
+
+ 让Label字体大小适应宽度, 设置的字体为最大字体, 如果文字超出会缩小字体. + + + + + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/LoadingIndicator.html" "b/Doc/API/\347\261\273/LoadingIndicator.html" new file mode 100644 index 00000000..5ec0e165 --- /dev/null +++ "b/Doc/API/\347\261\273/LoadingIndicator.html" @@ -0,0 +1,269 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class LoadingIndicator

+

菊花, 活动状体指示器

+

LoadingIndicator的父类是View

+ + +

全局函数

+ + + + + +
LoadingIndicator ()创建一个LoadingIndicator对象
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + +
start ()菊花开始转动
stop ()菊花停止转动
isAnimating ()菊花是否转动中
color (color, alpha)设置菊花颜色
color ()获取菊花颜色
+ +
+
+ + +

全局函数

+ +
+
+ + LoadingIndicator () +
+
+ 创建一个LoadingIndicator对象 + + + +

返回值:

+
    + + LoadingIndicator + view +
+ + + +

例子:

+
    +
    local view = LoadingIndicator();
    +
+ +
+
+

实例方法

+ +
+
+ + start () +
+
+ 菊花开始转动 + + + + + + + +
+
+ + stop () +
+
+ 菊花停止转动 + + + + + + + +
+
+ + isAnimating () +
+
+ 菊花是否转动中 + + + + + + + +
+
+ + color (color, alpha) +
+
+ 设置菊花颜色 + + +

参数:

+
    +
  • color + int + + + +
  • +
  • alpha + number + 默认值是1 +
  • +
+ + + + + +
+
+ + color () +
+
+ 获取菊花颜色 + + + +

返回值:

+
    +
  1. + int + color
  2. +
  3. + number + alpha
  4. +
+ + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/Mtop.html" "b/Doc/API/\347\261\273/Mtop.html" new file mode 100644 index 00000000..e2942c63 --- /dev/null +++ "b/Doc/API/\347\261\273/Mtop.html" @@ -0,0 +1,265 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class Mtop

+

Mtop请求接口

+

+ +

+ + +

全局函数

+ + + + + +
Mtop (params, callback)创建Mtop对象
+

实例方法

+ + + + + + + + + + + + + + + + + +
request ()发起请求
cancel ()取消mtop请求
responseData ()获取得到的数据
responseHeaders ()获取得到的头信息
+ +
+
+ + +

全局函数

+ +
+
+ + Mtop (params, callback) +
+
+ 创建Mtop对象 + + +

参数:

+
    +
  • params + table + Mtop请求参数 (可选) +
  • +
  • callback + function + (可选) +
  • +
+ + + + +

例子:

+
    +
    + Mtop(
    +     {
    +         method = "mtop.ju.block.optionminisite.get",
    +         version= "1.0",
    +         params = {
    +             platformId = "8001",
    +             page = 1,
    +             pageSize = 10000,
    +             optStr = self.optStr
    +            },
    +     },
    +     ^( data, error){
    +         self.isLoading = false;
    +         if( data ) {
    +             local model = data.model;
    +             if( self.extend==nil )
    +                 self.extend = {};
    +             self.extend.syncOutput = model;
    +             self.haveItems = true;
    +             print(self.displayName, self.optStr, "loaded: ");
    +         } else {
    +             print(self.displayName, self.optStr, "error: ", error);
    +         }
    +         if( callback ) {
    +            callback(option);
    +         }
    +         self.hiddenLoadingView();
    +     }
    + );
    +
+ +
+
+

实例方法

+ +
+
+ + request () +
+
+ 发起请求 + + + + + + + +
+
+ + cancel () +
+
+ 取消mtop请求 + + + + + + + +
+
+ + responseData () +
+
+ 获取得到的数据 + + + + + + + +
+
+ + responseHeaders () +
+
+ 获取得到的头信息 + + + + + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/Navigation.html" "b/Doc/API/\347\261\273/Navigation.html" new file mode 100644 index 00000000..381d9997 --- /dev/null +++ "b/Doc/API/\347\261\273/Navigation.html" @@ -0,0 +1,256 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class Navigation

+

Navigation + 导航栏菜单控制器

+

+ +

+ + +

全局函数

+ + + + + + + + + + + + + + + + + + + + + +
Navigation.title (view)设置导航栏 标题
Navigation.left (view)设置导航栏 左菜单
Navigation.right (view)设置导航栏 右菜单
Navigation.background (imageView)设置导航栏背景图片
Navigation.statusBarStyle (style)设置状态栏样式
+ +
+
+ + +

全局函数

+ +
+
+ + Navigation.title (view) +
+
+ 设置导航栏 标题 + + +

参数:

+
    +
  • view + View + 标题view +
  • +
+ + + + + +
+
+ + Navigation.left (view) +
+
+ 设置导航栏 左菜单 + + +

参数:

+
    +
  • view + View + 菜单view 可以设置多个 +
  • +
+ + + + + +
+
+ + Navigation.right (view) +
+
+ 设置导航栏 右菜单 + + +

参数:

+
    +
  • view + View + 菜单view 可以设置多个 +
  • +
+ + + + + +
+
+ + Navigation.background (imageView) +
+
+ 设置导航栏背景图片 + + +

参数:

+
    +
  • imageView + Image + 背景图片 +
  • +
+ + + + + +
+
+ + Navigation.statusBarStyle (style) +
+
+ 设置状态栏样式 + + +

参数:

+
    +
  • style + int + 样式 +
  • +
+ + + + +

例子:

+
    +
    + style 样式:
    + StatusBarStyleDefault = 0
    + StatusBarStyleLightContent = 1 
    +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/PageView.html" "b/Doc/API/\347\261\273/PageView.html" new file mode 100644 index 00000000..b047e357 --- /dev/null +++ "b/Doc/API/\347\261\273/PageView.html" @@ -0,0 +1,342 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class PageView

+

PageView + 横向分页滚动的View

+

PageView的父类是View

+ + +

全局函数

+ + + + + +
PageView (delegate)创建一个PageView对象
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
currentPage (currentPage)设置当前页面
currentPage ()获取当前页面
reload ()重新加载PageView
indicator (indicator)设置PagerView的indicator
indicator ()获取PagerView的indicator
showScrollBar (show)设置是否显示滚动条
showScrollBar ()获取是否显示滚动条
+ +
+
+ + +

全局函数

+ +
+
+ + PageView (delegate) +
+
+ 创建一个PageView对象 + + +

参数:

+
    +
  • delegate + table + 参数 +
  • +
+ +

返回值:

+
    + + PageView + pageView +
+ + + +

例子:

+
    +
     local pageView = PageView();
    + require "lv_kit"
    +
    + local width, height= System.screenSize()
    +
    + pageView = PageView({
    +     PageCount = 12,
    +     Pages = {
    +         Init = function(page, pos)
    +             page.icon = Button()
    +         end,
    +         Layout = function(page, pos)
    +             page.icon.text("测试按钮"..pos)
    +             page.icon.frame(0, 0, width, 200)
    +         end
    +     },
    +     Callback = {
    +
    +         Scrolling = function( pageIndex, percent , offset )
    +             print("Scrolling", pageIndex, percent, offset)
    +         end,
    +
    +         ScrollEnd = function( pageIndex )
    +             print("ScrollEnd", pageIndex )
    +         end
    +
    +     }
    + })
    +
    + windowWidth , windowHeight = window.size();
    + pageView.frame(0,0,windowWidth,windowHeight-64)
    +
+ +
+
+

实例方法

+ +
+
+ + currentPage (currentPage) +
+
+ 设置当前页面 + + +

参数:

+
    +
  • currentPage + number + 当前页面id +
  • +
+ + + + + +
+
+ + currentPage () +
+
+ 获取当前页面 + + + + + + + +
+
+ + reload () +
+
+ 重新加载PageView + + + + + + + +
+
+ + indicator (indicator) +
+
+ 设置PagerView的indicator + + +

参数:

+
    +
  • indicator + number + PagerIndicator +
  • +
+ + + + + +
+
+ + indicator () +
+
+ 获取PagerView的indicator + + + + + + + +
+
+ + showScrollBar (show) +
+
+ 设置是否显示滚动条 + + +

参数:

+
    +
  • show + bool + 是否显示滚动条 +
  • +
+ + + + + +
+
+ + showScrollBar () +
+
+ 获取是否显示滚动条 + + + + + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/PagerIndicator.html" "b/Doc/API/\347\261\273/PagerIndicator.html" new file mode 100644 index 00000000..9662f33d --- /dev/null +++ "b/Doc/API/\347\261\273/PagerIndicator.html" @@ -0,0 +1,329 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class PagerIndicator

+

PagerIndicator + banner滚动第几页的小圆点

+

PagerIndicator的父类是View

+ + +

全局函数

+ + + + + +
PagerIndicator ()创建一个PagerIndicator对象
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + + + + + +
currentPage (page)设置当前选中页
currentPage ()获取当前选中页
pageColor (color, alpha)设置未选中页的颜色
pageColor ()获取未选中页的颜色
currentPageColor (color, alpha)设置选中页的颜色
currentPageColor ()获取选中页的颜色
+ +
+
+ + +

全局函数

+ +
+
+ + PagerIndicator () +
+
+ 创建一个PagerIndicator对象 + + + +

返回值:

+
    + + PagerIndicator + pageControl +
+ + + +

例子:

+
    +
    local pageControl = PagerIndicator();
    +
+ +
+
+

实例方法

+ +
+
+ + currentPage (page) +
+
+ 设置当前选中页 + + +

参数:

+
    +
  • page + int + + + +
  • +
+ + + + + +
+
+ + currentPage () +
+
+ 获取当前选中页 + + + +

返回值:

+
    + + int + page +
+ + + + +
+
+ + pageColor (color, alpha) +
+
+ 设置未选中页的颜色 + + +

参数:

+
    +
  • color + int + + + +
  • +
  • alpha + number + + + +
  • +
+ + + + + +
+
+ + pageColor () +
+
+ 获取未选中页的颜色 + + + +

返回值:

+
    +
  1. + int + color
  2. +
  3. + number + alpha
  4. +
+ + + + +
+
+ + currentPageColor (color, alpha) +
+
+ 设置选中页的颜色 + + +

参数:

+
    +
  • color + int + + + +
  • +
  • alpha + number + + + +
  • +
+ + + + + +
+
+ + currentPageColor () +
+
+ 获取选中页的颜色 + + + +

返回值:

+
    +
  1. + int + color
  2. +
  3. + number + alpha
  4. +
+ + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/ScrollView.html" "b/Doc/API/\347\261\273/ScrollView.html" new file mode 100644 index 00000000..caf1711f --- /dev/null +++ "b/Doc/API/\347\261\273/ScrollView.html" @@ -0,0 +1,509 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class ScrollView

+

ScrollView + 可滚动的View

+

ScrollView的父类是View, 子类有TableView, CollectionView

+ + +

全局函数

+ + + + + +
ScrollView ()通过这个方法创建一个ScrollView对象
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
callback (callback)设置事件回调callback
contentSize (w, h)设置ContentSize大小
contentSize ()获取ContentSize大小
offset (x, y, animation)设置ContentSize大小
offset ()获取contentOffset大小
contentInset (top, left, bottom, right)设置contentInset
contentInset ()获取contentInset
showScrollIndicator (showsHorizontal, showsVertical)设置是否显示滚动条
showScrollIndicator ()获取是否显示滚动条信息
startRefreshing ()代码控制 开始下拉刷新动画
stopRefreshing ()停止下拉刷新动画(数据已经加载完成后调用)
isRefreshing ()是否正在下拉刷新动画中
+ +
+
+ + +

全局函数

+ +
+
+ + ScrollView () +
+
+ 通过这个方法创建一个ScrollView对象 + + + +

返回值:

+
    + + ScrollView + view +
+ + + + +
+
+

实例方法

+ +
+
+ + callback (callback) +
+
+ 设置事件回调callback + + +

参数:

+
    +
  • callback + table + 代理方法 +
  • +
+ + + + +

例子:

+
    +
    + --例子二:
    + local scrW, scrH = System.screenSize();
    + scrollView = ScrollView();
    + scrollView.backgroundColor(0xffFFFF);
    + scrollView.frame(0, 0, scrW, imageH );
    + scrollView.callback{
    +         PullDown=^(){
    +             -- 开始下拉刷新回调
    +         },
    +         PullUp = ^(){
    +             -- 开始上拉刷新回调
    +         },
    +         Scrolling=^(){
    +             -- 滚动中
    +         },
    +         Begin = ^(){
    +             -- 开始滚动
    +         },
    +         End=^(){
    +             -- 结束滚动
    +         }
    +  };
    +
+ +
+
+ + contentSize (w, h) +
+
+ 设置ContentSize大小 + + +

参数:

+
    +
  • w + number + 宽 +
  • +
  • h + number + 高 +
  • +
+ + + + + +
+
+ + contentSize () +
+
+ 获取ContentSize大小 + + + +

返回值:

+
    +
  1. + number + w 宽
  2. +
  3. + number + h 高
  4. +
+ + + + +
+
+ + offset (x, y, animation) +
+
+ 设置ContentSize大小 + + +

参数:

+
    +
  • x + number + x滚动偏移位置 +
  • +
  • y + number + y滚动偏移位置 +
  • +
  • animation + bool + 是否动画 参数可以省略 +
  • +
+ + + + + +
+
+ + offset () +
+
+ 获取contentOffset大小 + + + +

返回值:

+
    +
  1. + number + x
  2. +
  3. + number + y
  4. +
+ + + + +
+
+ + contentInset (top, left, bottom, right) +
+
+ 设置contentInset + + +

参数:

+
    +
  • top + number + + + +
  • +
  • left + number + + + +
  • +
  • bottom + number + + + +
  • +
  • right + number + + + +
  • +
+ + + + + +
+
+ + contentInset () +
+
+ 获取contentInset + + + +

返回值:

+
    +
  1. + number + top
  2. +
  3. + number + left
  4. +
  5. + number + bottom
  6. +
  7. + number + right
  8. +
+ + + + +
+
+ + showScrollIndicator (showsHorizontal, showsVertical) +
+
+ 设置是否显示滚动条 + + +

参数:

+
    +
  • showsHorizontal + bool + 显示水平滚动条 +
  • +
  • showsVertical + bool + 显示纵向滚动条 +
  • +
+ + + + + +
+
+ + showScrollIndicator () +
+
+ 获取是否显示滚动条信息 + + + +

返回值:

+
    +
  1. + bool + showsHorizontal 显示水平滚动条
  2. +
  3. + bool + showsVertical 显示纵向滚动条
  4. +
+ + + + +
+
+ + startRefreshing () +
+
+ 代码控制 开始下拉刷新动画 + + + + + + + +
+
+ + stopRefreshing () +
+
+ 停止下拉刷新动画(数据已经加载完成后调用) + + + + + + + +
+
+ + isRefreshing () +
+
+ 是否正在下拉刷新动画中 + + + + + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/StyledString.html" "b/Doc/API/\347\261\273/StyledString.html" new file mode 100644 index 00000000..99fdc7e7 --- /dev/null +++ "b/Doc/API/\347\261\273/StyledString.html" @@ -0,0 +1,251 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class StyledString

+

复合文本 + 可以设置字符串的字体/颜色/背景色/前景色

+

+ +

+ + +

全局函数

+ + + + + +
StyledString (string, table)通过这个方法创建一个StyledString对象
+

实例方法

+ + + + + +
append (attrString)连接两个StyledString
+

元方法

+ + + + + +
__add (attrString)连接两个StyledString
+ +
+
+ + +

全局函数

+ +
+
+ + StyledString (string, table) +
+
+ 通过这个方法创建一个StyledString对象 + + +

参数:

+
    +
  • string + string + 文本 +
  • +
  • table + table + 属性表 +
  • +
+ + + + +

例子:

+
    +
     local view = StyledString();
    + w,h = System.screenSize();
    + window.frame(0, 0, w, h);
    +
    + att1 = StyledString( "123test",  { fontSize=12, fontWeight="bold", fontColor=0xff } );
    + att2 = StyledString( "测试测试",  { fontSize=30, fontColor=0xff0000, backgroundColor=0xff} );
    + att3 = StyledString( "2897348",  { fontSize=13, fontColor=0x777777, strikethrough=true} );
    + att4 = StyledString( "下划线测试", { fontSize=9, fontColor=0x777777, underline=true} );
    +
    + label = Label();
    + label.frame(0,30,w, 60);
    + label.text(att1 + att2 + att3 + att4);
    +      
    +
+ +
+
+

实例方法

+ +
+
+ + append (attrString) +
+
+ 连接两个StyledString + + +

参数:

+ + + + + +

例子:

+
    +
     local
    + local att1 = StyledString( "123test",  { fontSize=12, fontWeight="bold", fontColor=0xff } );
    + local att2 = StyledString( "测试测试",  { fontSize=30, fontColor=0xff0000, backgroundColor=0xff} );
    + att1.append(att2);
    +    
    +
+ +
+
+

元方法

+ +
+
+ + __add (attrString) +
+
+ 连接两个StyledString + + +

参数:

+ + + + + +

例子:

+
    +
     local
    + local att1 = StyledString( "123test",  { fontSize=12, fontWeight="bold", fontColor=0xff } );
    + local att2 = StyledString( "测试测试",  { fontSize=30, fontColor=0xff0000, backgroundColor=0xff} );
    + local att3 = att1 + att2;
    +      
    +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/TableView.html" "b/Doc/API/\347\261\273/TableView.html" new file mode 100644 index 00000000..1a66e642 --- /dev/null +++ "b/Doc/API/\347\261\273/TableView.html" @@ -0,0 +1,350 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class TableView

+

TableView + 每行高度样式可定制和重复利用的列表

+

TableView的父类是ScrollView

+ + +

全局函数

+ + + + + +
TableView (source)设置TableView代理
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + + + + + +
reload ()重新刷新加载TableView
header (header)设置TableView的头
footer (footer)设置TableView的尾
isRefreshing ()是否正在下拉刷新动画中
startRefreshing ()代码控制 开始下拉刷新动画
stopRefreshing ()停止下拉刷新动画(数据已经加载完成后调用)
+ +
+
+ + +

全局函数

+ +
+
+ + TableView (source) +
+
+ 设置TableView代理 + + +

参数:

+
    +
  • source + table + 数据源 +
  • +
+ + + + +

例子:

+
    +
    + tableView = TableView{
    +     Section = {
    +         SectionCount = 2, -- section数量
    +
    +         RowCount = ^(section){ -- 每个section的行数
    +             return 10;
    +         }
    +     },
    +
    +     Cell = {
    +         Id = ^( section, row ){ -- 指定section和row对应的Cell类型唯一识别号
    +             return  "图片+文字";
    +         }
    +         "图片+文字" = { -- cell 具体样式
    +             Height = ^( section, row ){ -- 指定section和row 对应的高度
    +                 return cellHeight;
    +             }
    +             Init = ^(cell, section, row){ -- 初始化cell
    +                 cell.icon = Image();
    +                 cell.title = Label();
    +                 print("构造Cell");
    +             },
    +             Layout = ^(cell, section, row){ -- cell复用时调用
    +                 cell.icon.frame(0, 0, cellHeight, cellHeight);
    +                 cell.icon.image(imageUrl1);
    +
    +                 cell.title.frame(cellHeight, 0, w-cellHeight, cellHeight);
    +                cell.title.yext("测试"..section .."--" .. row);
    +             },
    +             Callack = ^(cell, section, row ){ -- 用户点击了section和row
    +                 print(section, row);
    +                 tableView.reload();
    +                 System.gc();
    +             }
    +     },
    +     Callback = {
    +         PullDown=^(){
    +             -- 开始下拉刷新回调
    +         },
    +         PullUp = ^(){
    +             -- 开始上拉刷新回调
    +         },
    +         Scrolling=^(){
    +             -- 滚动中
    +         },
    +         ScrollBegin = ^(){
    +             -- 开始滚动
    +         },
    +         ScrollEnd=^(){
    +             -- 结束滚动
    +         }
    +     }
    +  };
    +
    + tableView.frame(0,50,w,h-100);
    + tableView.backgroundColor(0xffFFFF);
    +
    + local head = Button();
    + head.title("我是头");
    + head.frame(0,0,w,100);
    + head.backgroundColor(0xff);
    + tableView.header( head );
    +
    + local foot = Button();
    + foot.title("我是结尾");
    + foot.frame(0,0,w,100);
    + foot.backgroundColor(0xff0000);
    + tableView.footer( foot );
    +    
    +
+ +
+
+

实例方法

+ +
+
+ + reload () +
+
+ 重新刷新加载TableView + + + + + + + +
+
+ + header (header) +
+
+ 设置TableView的头 + + +

参数:

+
    +
  • header + View + 头view +
  • +
+ + + + + +
+
+ + footer (footer) +
+
+ 设置TableView的尾 + + +

参数:

+
    +
  • footer + View + 尾view +
  • +
+ + + + + +
+
+ + isRefreshing () +
+
+ 是否正在下拉刷新动画中 + + + + + + + +
+
+ + startRefreshing () +
+
+ 代码控制 开始下拉刷新动画 + + + + + + + +
+
+ + stopRefreshing () +
+
+ 停止下拉刷新动画(数据已经加载完成后调用) + + + + + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/TextField.html" "b/Doc/API/\347\261\273/TextField.html" new file mode 100644 index 00000000..ec0257c1 --- /dev/null +++ "b/Doc/API/\347\261\273/TextField.html" @@ -0,0 +1,345 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class TextField

+

TextField + 文本输入框

+

TextField的父类是View

+ + +

全局函数

+ + + + + +
TextField ()通过这个方法创建一个TextField对象
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
text (s)设置文本内容
text ()获取文本内容
placeholder (s)设置palceHolder内容
placeholder ()获取placeHolder内容
hint (s)设置hint内容
hint ()获取hint内容
callback (delegate)设置delegate
+ +
+
+ + +

全局函数

+ +
+
+ + TextField () +
+
+ 通过这个方法创建一个TextField对象 + + + +

返回值:

+
    + + TextField + textField +
+ + + +

例子:

+
    +
    local textField = TextField();
    +
+ +
+
+

实例方法

+ +
+
+ + text (s) +
+
+ 设置文本内容 + + +

参数:

+ + + + + + +
+
+ + text () +
+
+ 获取文本内容 + + + +

返回值:

+
    + + string + s text +
+ + + + +
+
+ + placeholder (s) +
+
+ 设置palceHolder内容 + + +

参数:

+ + + + + + +
+
+ + placeholder () +
+
+ 获取placeHolder内容 + + + +

返回值:

+
    + + string + s text +
+ + + + +
+
+ + hint (s) +
+
+ 设置hint内容 + + +

参数:

+ + + + + + +
+
+ + hint () +
+
+ 获取hint内容 + + + +

返回值:

+
    + + string + s text +
+ + + + +
+
+ + callback (delegate) +
+
+ 设置delegate + + +

参数:

+
    +
  • delegate + function + 代理方法 +
  • +
+ + + + +

例子:

+
    +
     button.callback(
    +    {
    +         BeginEditing = ^(){ --开始编辑
    +         },
    +         EndEditing = ^(){ -- 结束编辑
    +         },
    +         Clear = ^(){ -- 清理
    +         },
    +         Return = ^(){ --返回
    +         }
    +    }
    + );
    +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/Timer.html" "b/Doc/API/\347\261\273/Timer.html" new file mode 100644 index 00000000..f9efc003 --- /dev/null +++ "b/Doc/API/\347\261\273/Timer.html" @@ -0,0 +1,247 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class Timer

+

Timer + 定时器接口

+

+ +

+ + +

全局函数

+ + + + + + + + + +
Timer ()创建定时器Timer
Timer (callback)创建定时器Timer
+

实例方法

+ + + + + + + + + + + + + +
start (time, repeat)启动定时器
cancel ()取消定时器
callback (callback)设置回调
+ +
+
+ + +

全局函数

+ +
+
+ + Timer () +
+
+ 创建定时器Timer + + + + + + + +
+
+ + Timer (callback) +
+
+ 创建定时器Timer + + +

参数:

+
    +
  • callback + function + 定时器回调 +
  • +
+ + + + + +
+
+

实例方法

+ +
+
+ + start (time, repeat) +
+
+ 启动定时器 + + +

参数:

+
    +
  • time + number + 间隔时间 +
  • +
  • repeat + bool + 是否重复 +
  • +
+ + + + + +
+
+ + cancel () +
+
+ 取消定时器 + + + + + + + +
+
+ + callback (callback) +
+
+ 设置回调 + + +

参数:

+
    +
  • callback + function + 定时器回调 +
  • +
+ + + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/Toast.html" "b/Doc/API/\347\261\273/Toast.html" new file mode 100644 index 00000000..98931aae --- /dev/null +++ "b/Doc/API/\347\261\273/Toast.html" @@ -0,0 +1,146 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class Toast

+

Toast + 弹出提示框

+

+ +

+ + +

全局函数

+ + + + + +
Toast ()弹出一个提示框(3秒自动消失的)
+ +
+
+ + +

全局函数

+ +
+
+ + Toast () +
+
+ 弹出一个提示框(3秒自动消失的) + + + + + + +

例子:

+
    +
    Toast("提示信息");
    +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/Transform3D.html" "b/Doc/API/\347\261\273/Transform3D.html" new file mode 100644 index 00000000..469a03ea --- /dev/null +++ "b/Doc/API/\347\261\273/Transform3D.html" @@ -0,0 +1,514 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class Transform3D

+

Transform3D + 用于设置View的3D变换矩阵

+

+ +

+ + +

全局函数

+ + + + + +
Transform3D ()通过这个方法创建一个Transform3D对象
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
translation (translationX, translationY, translationZ)设置矩阵为平移变换
scale (scaleX, scaleY, scaleZ)设置矩阵为缩放变换
rotate (roteX, roteY, roteZ)设置矩阵为旋转变换
isIdentity ()检测矩阵是否是单位矩阵
reset ()初始化矩阵为单位矩阵
set (transform)矩阵赋值
concat (transform)矩阵相乘
+

元方法

+ + + + + + + + + +
__eq (transform)比较矩阵是否相同
__mul (transform)矩阵相乘
+ +
+
+ + +

全局函数

+ +
+
+ + Transform3D () +
+
+ 通过这个方法创建一个Transform3D对象 + + + +

返回值:

+
    + + Transform3D + 变换矩阵 +
+ + + +

例子:

+
    +
    local t = Transform3D();
    +
+ +
+
+

实例方法

+ +
+
+ + translation (translationX, translationY, translationZ) +
+
+ 设置矩阵为平移变换 + + +

参数:

+
    +
  • translationX + number + x轴平移 +
  • +
  • translationY + number + y轴平移 +
  • +
  • translationZ + number + y轴平移 +
  • +
+ +

返回值:

+
    + + Transform3D + 矩阵自身 +
+ + + +

例子:

+
    +
     local t = Transform3D();
    + t.translation( 10, 100, 50);
    + imageView.transform3D(t);
    +
+ +
+
+ + scale (scaleX, scaleY, scaleZ) +
+
+ 设置矩阵为缩放变换 + + +

参数:

+
    +
  • scaleX + number + x轴缩放 +
  • +
  • scaleY + number + y轴缩放 +
  • +
  • scaleZ + number + z轴缩放 +
  • +
+ +

返回值:

+
    + + Transform3D + 矩阵自身 +
+ + + +

例子:

+
    +
     local t = Transform3D();
    + t.scale( 3.14/3, 0, 1);
    + imageView.transform3D(t);
    +
+ +
+
+ + rotate (roteX, roteY, roteZ) +
+
+ 设置矩阵为旋转变换 + + +

参数:

+
    +
  • roteX + number + x轴旋转 +
  • +
  • roteY + number + y轴旋转 +
  • +
  • roteZ + number + z轴旋转 +
  • +
+ +

返回值:

+
    + + Transform3D + 矩阵自身 +
+ + + +

例子:

+
    +
     local t = Transform3D();
    + t.rotate( 3.14/3, 0, 1);
    + imageView.transform3D(t);
    +
+ +
+
+ + isIdentity () +
+
+ 检测矩阵是否是单位矩阵 + + + +

返回值:

+
    + + bool + 是否是单位矩阵 +
+ + + +

例子:

+
    +
     local t = Transform3D();
    + t.rotate( 3.14/3, 0, 1);
    + imageView.transform3D(t);
    +
+ +
+
+ + reset () +
+
+ 初始化矩阵为单位矩阵 + + + +

返回值:

+
    + + Transform3D + 矩阵自身 +
+ + + +

例子:

+
    +
    local t = Transform3D();
    + t.reset();
    +
+ +
+
+ + set (transform) +
+
+ 矩阵赋值 + + +

参数:

+ + +

返回值:

+
    + + Transform3D + 矩阵自身 +
+ + + +

例子:

+
    +
     local transform1 = Transform3D();
    + local transform2 = Transform3D();
    + transform1.set(transform2);
    +
+ +
+
+ + concat (transform) +
+
+ 矩阵相乘 + + +

参数:

+ + +

返回值:

+
    + + Transform3D + 矩阵自身 +
+ + + +

例子:

+
    +
     local transform1 = Transform3D();
    + local transform2 = Transform3D();
    + transform1.concat(transform2);
    +
+ +
+
+

元方法

+ +
+
+ + __eq (transform) +
+
+ 比较矩阵是否相同 + + +

参数:

+ + +

返回值:

+
    + + bool + 是否相等 +
+ + + +

例子:

+
    +
     local transform1 = Transform3D();
    + local transform2 = Transform3D();
    + if( transform1 == transform2) ){
    +     --相同
    + } else {
    +    -- 不相同
    + }
    +
+ +
+
+ + __mul (transform) +
+
+ 矩阵相乘 + + +

参数:

+ + +

返回值:

+
    + + Transform3D + 新的矩阵 +
+ + + +

例子:

+
    +
     local transform1 = Transform3D();
    + local transform2 = Transform3D();
    + local transform3 = transform1 * transform2;
    +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/UIActivityIndicatorView.html" "b/Doc/API/\347\261\273/UIActivityIndicatorView.html" new file mode 100644 index 00000000..5c9b346b --- /dev/null +++ "b/Doc/API/\347\261\273/UIActivityIndicatorView.html" @@ -0,0 +1,267 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class UIActivityIndicatorView

+

菊花, 活动状体指示器

+

UIActivityIndicatorView的父类是UIView

+ + +

全局函数

+ + + + + +
UIActivityIndicatorView ()创建一个UIActivityIndicatorView对象
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + +
startAnimating ()菊花开始转动
stopAnimating ()菊花停止转动
isAnimating ()菊花是否转动中
setColor (color, alpha)设置菊花颜色
color ()获取菊花颜色
+ +
+
+ + +

全局函数

+ +
+
+ + UIActivityIndicatorView () +
+
+ 创建一个UIActivityIndicatorView对象 + + + +

返回值:

+
    + + UIActivityIndicatorView + view +
+ + + +

例子:

+
    +
    local view = UIActivityIndicatorView();
    +
+ +
+
+

实例方法

+ +
+
+ + startAnimating () +
+
+ 菊花开始转动 + + + + + + + +
+
+ + stopAnimating () +
+
+ 菊花停止转动 + + + + + + + +
+
+ + isAnimating () +
+
+ 菊花是否转动中 + + + + + + + +
+
+ + setColor (color, alpha) +
+
+ 设置菊花颜色 + + +

参数:

+
    +
  • color + int + + + +
  • +
  • alpha + number + + + +
  • +
+ + + + + +
+
+ + color () +
+
+ 获取菊花颜色 + + + +

返回值:

+
    +
  1. + int + color
  2. +
  3. + number + alpha
  4. +
+ + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/UIAlert.html" "b/Doc/API/\347\261\273/UIAlert.html" new file mode 100644 index 00000000..54b710b6 --- /dev/null +++ "b/Doc/API/\347\261\273/UIAlert.html" @@ -0,0 +1,157 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class UIAlert

+

UIAlert + 弹出系统自带的提示框

+

+ +

+ + +

全局函数

+ + + + + +
UIAlert ()弹出一个提示框
+ +
+
+ + +

全局函数

+ +
+
+ + UIAlert () +
+
+ 弹出一个提示框 + + + +

返回值:

+
    + + UIAlert + view +
+ + + +

例子:

+
    +
    + UIAlert("标题", "内容",
    +                "确定","取消", -- 按钮个数支持0~10个
    +                 ^(index){
    +                        print("按钮ID:",index)
    +                        if index==0 then
    +                            window.release();
    +                        end
    +                 }
    +            );
    +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/UIAlertView.html" "b/Doc/API/\347\261\273/UIAlertView.html" new file mode 100644 index 00000000..643eb320 --- /dev/null +++ "b/Doc/API/\347\261\273/UIAlertView.html" @@ -0,0 +1,158 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class UIAlertView

+

UIAlertView + 系统自带的弹出提示框

+

+ +

+ + +

全局函数

+ + + + + +
UIAlertView ()创建一个UIAlertView对象
+ +
+
+ + +

全局函数

+ +
+
+ + UIAlertView () +
+
+ 创建一个UIAlertView对象 + + + +

返回值:

+
    + + UIAlertView + view +
+ + + +

例子:

+
    +
    + UIAlertView("标题", "内容",
    +                "确定","取消", -- 按钮个数支持0~10个
    +                 ^(index){
    +                        print("按钮ID:",index)
    +                        if index==0 then
    +                            window.release();
    +                        end
    +                 }
    +            );
    +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/UIAnimate.html" "b/Doc/API/\347\261\273/UIAnimate.html" new file mode 100644 index 00000000..9b36e828 --- /dev/null +++ "b/Doc/API/\347\261\273/UIAnimate.html" @@ -0,0 +1,382 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class UIAnimate

+

动画API

+

+ +

+ + +

全局函数

+ + + + + + + + + + + + + + + + + + + + + +
UIAnimate (animations)通过这个方法 设置动画的时间,延时,最终状态,结束回调
UIAnimate (animations, completion)通过这个方法 设置动画的时间,延时,最终状态,结束回调
UIAnimate (duration, animations, completion)通过这个方法 设置动画的时间,延时,最终状态,结束回调
UIAnimate (duration, delay, animations, completion)通过这个方法 设置动画的时间,延时,最终状态,结束回调
UIAnimate (duration, delay, option, animations, completion)通过这个方法 设置动画的时间,延时,最终状态,结束回调
+ +
+
+ + +

全局函数

+ +
+
+ + UIAnimate (animations) +
+
+ 通过这个方法 设置动画的时间,延时,最终状态,结束回调 + + +

参数:

+
    +
  • animations + function + 动画过程回调 --- 该参数是必填参数 +
  • +
+ + + + +

例子:

+
    +
     --例子五
    + local button = UIButton();
    + button.center(0,0);
    + UIAnimate(
    +     function (){
    +         button.center(100,100);
    +     }
    + );
    +
+ +
+
+ + UIAnimate (animations, completion) +
+
+ 通过这个方法 设置动画的时间,延时,最终状态,结束回调 + + +

参数:

+
    +
  • animations + function + 动画过程回调 --- 该参数是必填参数 +
  • +
  • completion + function + 动画结束回调 --- 该参数是可选的 默认值是nil +
  • +
+ + + + +

例子:

+
    +
     --例子四
    + local button = UIButton();
    + button.center(0,0);
    + UIAnimate(
    +     function (){
    +         button.center(100,100);
    +     },
    +     function (){
    +         print("动画结束了");
    +     }
    + );
    +
+ +
+
+ + UIAnimate (duration, animations, completion) +
+
+ 通过这个方法 设置动画的时间,延时,最终状态,结束回调 + + +

参数:

+
    +
  • duration + number + 动画耗费时间(单位秒) --- 该参数是可选的 默认值是0.3 +
  • +
  • animations + function + 动画过程回调 --- 该参数是必填参数 +
  • +
  • completion + function + 动画结束回调 --- 该参数是可选的 默认值是nil +
  • +
+ + + + +

例子:

+
    +
     --2. 例子三
    + local button = UIButton();
    + button.center(0,0);
    + UIAnimate(
    +     1.5, -- 动画时间
    +     function (){
    +         button.center(100,100);
    +     },
    +     function (){
    +         print("动画结束了");
    +     }
    + );
    +
+ +
+
+ + UIAnimate (duration, delay, animations, completion) +
+
+ 通过这个方法 设置动画的时间,延时,最终状态,结束回调 + + +

参数:

+
    +
  • duration + number + 动画耗费时间(单位秒) --- 该参数是可选的 默认值是0.3 +
  • +
  • delay + number + 动画延时多少时间后启动(单位秒) --- 该参数是可选的 默认值是0 +
  • +
  • animations + function + 动画过程回调 --- 该参数是必填参数 +
  • +
  • completion + function + 动画结束回调 --- 该参数是可选的 默认值是nil +
  • +
+ + + + +

例子:

+
    +
     --2. 例子二(更多参数)
    + local button = UIButton();
    + button.center(0,0);
    + UIAnimate(
    +     1.5, -- 动画时间
    +     2, -- 动画延时
    +     function (){
    +         button.center(100,100);
    +     },
    +     function (){
    +         print("动画结束了");
    +     }
    + );
    +
+ +
+
+ + UIAnimate (duration, delay, option, animations, completion) +
+
+ 通过这个方法 设置动画的时间,延时,最终状态,结束回调 + + +

参数:

+
    +
  • duration + number + 动画耗费时间(单位秒) --- 该参数是可选的 默认值是0.3 +
  • +
  • delay + number + 动画延时多少时间后启动(单位秒) --- 该参数是可选的 默认值是0 +
  • +
  • option + number + AnimationOptions参数 --- 该参数是可选的 默认值是0 +
  • +
  • animations + function + 动画过程回调 --- 该参数是必填参数 +
  • +
  • completion + function + 动画结束回调 --- 该参数是可选的 默认值是nil +
  • +
+ + + + +

例子:

+
    +
  •  -- 例子一
    + local button = UIButton();
    + button.center(0,0);
    + UIAnimate(
    +     1.5, -- 动画时间
    +     2, -- 动画延时
    +     0, -- 动画参数
    +     function (){
    +         button.center(100,100);
    +     },
    +     function (){
    +         print("动画结束了");
    +     }
    + );
  • +
  • + options 对应的 AnimationOptions 参数列表
    + UIViewAnimationOptionLayoutSubviews            = 1,
    + UIViewAnimationOptionAllowUserInteraction      = 2, -- turn on user interaction while animating
    + UIViewAnimationOptionBeginFromCurrentState     = 4, -- start all views from current value, not initial value
    + UIViewAnimationOptionRepeat                    = 8, -- repeat animation indefinitely
    + UIViewAnimationOptionAutoreverse               = 16, -- if repeat, run animation back and forth
    + UIViewAnimationOptionOverrideInheritedDuration = 32, -- ignore nested duration
    + UIViewAnimationOptionOverrideInheritedCurve    = 64, -- ignore nested curve
    + UIViewAnimationOptionAllowAnimatedContent      = 128, -- animate contents (applies to transitions only)
    + UIViewAnimationOptionShowHideTransitionViews   = 256, -- flip to/from hidden state instead of adding/removing
    + UIViewAnimationOptionOverrideInheritedOptions  = 512, -- do not inherit any options or animation type
    + UIViewAnimationOptionCurveEaseInOut            = 0, -- default
    + UIViewAnimationOptionCurveEaseIn               = 65536,
    + UIViewAnimationOptionCurveEaseOut              = 131072,
    + UIViewAnimationOptionCurveLinear               = 196608,
    + UIViewAnimationOptionTransitionNone            = 0, -- default
    + UIViewAnimationOptionTransitionFlipFromLeft    = 1048576; -- 1 << 20
    + UIViewAnimationOptionTransitionFlipFromRight   = 2097152; -- 2 << 20
    + UIViewAnimationOptionTransitionCurlUp          = 3145728; -- 3 << 20
    + UIViewAnimationOptionTransitionCurlDown        = 4194304; -- 4 << 20
    + UIViewAnimationOptionTransitionCrossDissolve   = 5242880; -- 5 << 20
    + UIViewAnimationOptionTransitionFlipFromTop     = 6291456; -- 6 << 20
    + UIViewAnimationOptionTransitionFlipFromBottom  = 7340032; -- 7 << 20
    + 
  • +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/UIButton.html" "b/Doc/API/\347\261\273/UIButton.html" new file mode 100644 index 00000000..d158d370 --- /dev/null +++ "b/Doc/API/\347\261\273/UIButton.html" @@ -0,0 +1,543 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class UIButton

+

UIButton + 按钮控件

+

UIButton的父类是UIView

+ + +

全局函数

+ + + + + +
UIButton (UIButton)通过这个方法可以创建一个UIButton对象
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
setTitle (title)设置按钮title
title ()获取按钮title
setText ()设置按钮title
text ()获取按钮title
setImage (normalImage, hightLightImage, disableImage)设置按钮图片
setFont (fontName, fontSize)设置按钮字体
font ()获取按钮title字体
setTitleColor (titleColor, alpha)设置按钮title颜色
titleColor ()获取按钮title颜色
setEnabled (enabled)设置按钮是否enabled
enabled ()获取按钮是否enabled
setShowsTouchWhenHighlighted (highLighted)设置按钮点击是否高亮
showsTouchWhenHighlighted ()获取按钮点击是否高亮
setDelegate (delegate)设置delegate
+ +
+
+ + +

全局函数

+ +
+
+ + UIButton (UIButton) +
+
+ 通过这个方法可以创建一个UIButton对象 + + +

参数:

+
    +
  • UIButton + function + + + +
  • +
+ +

返回值:

+
    + + person + father +
+ + + + +
+
+

实例方法

+ +
+
+ + setTitle (title) +
+
+ 设置按钮title + + +

参数:

+
    +
  • title + string + 标题 +
  • +
+ + + + + +
+
+ + title () +
+
+ 获取按钮title + + + + + + + +
+
+ + setText () +
+
+ 设置按钮title + + + + + + + +
+
+ + text () +
+
+ 获取按钮title + + + + + + + +
+
+ + setImage (normalImage, hightLightImage, disableImage) +
+
+ 设置按钮图片 + + +

参数:

+
    +
  • normalImage + string + normal图片样式 +
  • +
  • hightLightImage + string + 高亮图片 (可选) +
  • +
  • disableImage + string + disable的图片 (可选) +
  • +
+ + + + +

例子:

+
    +
    local btn = UIButton();
    +
+ +
+
+ + setFont (fontName, fontSize) +
+
+ 设置按钮字体 + + +

参数:

+
    +
  • fontName + string + 可选参数 +
  • +
  • fontSize + number + + + +
  • +
+ + + + +

例子:

+
    +
    local btn = UIButton();
    +
+ +
+
+ + font () +
+
+ 获取按钮title字体 + + + +

返回值:

+
    +
  1. + string + fontName
  2. +
  3. + number + fontSize
  4. +
+ + + +

例子:

+
    +
    local btn = UIButton();
    +
+ +
+
+ + setTitleColor (titleColor, alpha) +
+
+ 设置按钮title颜色 + + +

参数:

+
    +
  • titleColor + int + 颜色值 +
  • +
  • alpha + number + 透明度 +
  • +
+ + + + +

例子:

+
    +
    local btn = UIButton();
    +
+ +
+
+ + titleColor () +
+
+ 获取按钮title颜色 + + + +

返回值:

+
    +
  1. + int + color 颜色值
  2. +
  3. + number + alpha 透明度
  4. +
+ + + +

例子:

+
    +
    local btn = UIButton();
    +
+ +
+
+ + setEnabled (enabled) +
+
+ 设置按钮是否enabled + + +

参数:

+
    +
  • enabled + bool + 是否是能接受触摸事件 +
  • +
+ + + + + +
+
+ + enabled () +
+
+ 获取按钮是否enabled + + + +

返回值:

+
    + + bool + enable +
+ + + + +
+
+ + setShowsTouchWhenHighlighted (highLighted) +
+
+ 设置按钮点击是否高亮 + + +

参数:

+
    +
  • highLighted + bool + 是否高亮 +
  • +
+ + + + + +
+
+ + showsTouchWhenHighlighted () +
+
+ 获取按钮点击是否高亮 + + + +

返回值:

+
    + + bool + highlighted 是否高亮 +
+ + + + +
+
+ + setDelegate (delegate) +
+
+ 设置delegate + + +

参数:

+
    +
  • delegate + function + 代理方法 +
  • +
+ + + + +

例子:

+
    +
     button.setDelegate( function(){
    +     -- code
    + } );
    +
    + --或者:
    + button.delegate( function(){
    +    -- code
    + } );
    +
    + --或者:
    + button.delegate = function(){
    +     -- code
    + };
    +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/UICollectionView.html" "b/Doc/API/\347\261\273/UICollectionView.html" new file mode 100644 index 00000000..614d5aa4 --- /dev/null +++ "b/Doc/API/\347\261\273/UICollectionView.html" @@ -0,0 +1,436 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class UICollectionView

+

UICollectionView + 类似于Cell大小任意的TableView

+

UICollectionView的父类是UIScrollView

+ + +

全局函数

+ + + + + +
UICollectionView ()通过这个方法创建一个UICollectionView对象
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + +
setDelegate (delegate)设置Collection代理
reloadData ()重新加载刷新UICollectionView
rectForSection (section, row)获取给定section row 所在区域的位置大小
setMiniSpacing (miniSpacing)设置最小间距
miniSpacing ()获取最小间距
+ +
+
+ + +

全局函数

+ +
+
+ + UICollectionView () +
+
+ 通过这个方法创建一个UICollectionView对象 + + + +

返回值:

+
    + + UICollectionView + view +
+ + + +

例子:

+
    +
    local view = UICollectionView();
    +
+ +
+
+

实例方法

+ +
+
+ + setDelegate (delegate) +
+
+ 设置Collection代理 + + +

参数:

+
    +
  • delegate + table + 代理 +
  • +
+ + + + +

例子:

+
    +
  •  -- 例子一:
    + local collectionView = UICollectionView();
    + collectionView.setDelegate( {
    +        -- code
    +    } );
    + 或者:
    + local collectionView = UICollectionView();
    + collectionView.delegate( {
    +        -- code
    +    } );
    + 或者:
    + local collectionView = UICollectionView();
    + collectionView.delegate =  {
    +        -- code
    +    };
    + 或者:
    + local collectionView = UICollectionView(  {
    +        -- code
    +    } );
    +
    + 或者:
    + local collectionView = UICollectionView{
    +        -- code
    +    };
    +     
  • +
  •   -- 例子二:
    + local collectionView = UICollectionView();
    +     collectionView.delegate = {
    +         Section = {
    +             NumberOfSections = 3, -- section 数量
    +
    +             NumberOfRows = ^(section){ -- 每个section对应的行数
    +                 if ( section == 0 ){
    +                     -- 广告栏
    +                     return 0;
    +                 } else if( section==1 ) {
    +                     -- 十点上新提示
    +                     local theBrandMind = getOptionTheBrandMind(i);
    +                     if( theBrandMind ) {
    +                         return 1;
    +                     } else {
    +                         return 0;
    +                     }
    +                 }
    +                 -- 品牌团坑位
    +                 return getOptionItemsNum(i, section);
    +             },
    +             --Spacing = ^(section ){ -- 行间距
    +             --    return 0;
    +             --},
    +             --EdgeInsets = ^(section ){-- cell边距
    +             --   return 0,0,0,0;
    +             --}
    +
    +         },
    +         Cell = {
    +             Identifier = function ( section, row ){ -- cell唯一标识
    +                 if( section == 0 ) {
    +                     return "广告栏";
    +                 } else if( section == 1 ) {
    +                     return "十点上新";
    +                 } else {
    +                     return "品牌团";
    +                 }
    +             }
    +             "品牌团" = { -- 品牌团cell样式
    +                 Size = ^(section, row){ -- 每个Cell 尺寸
    +                     return scrW , (178 * scrW / 375);
    +                 },
    +                 Init = ^(cell){
    +                    BrandCellInit(cell);
    +                    cell.loading = UIActivityIndicatorView();
    +                 },
    +                 Layout = ^(cell , section, row){
    +                     local model = getOptionModel( i, section, row);
    +                     if ( model ) {
    +                         BrandCellLayout(cell, model );
    +                     }
    +                     cell.loading.startAnimating();
    +                     cell.loading.center(160,50);
    +                 },
    +                 Select = ^(section, row){
    +                     print(section, row);
    +                     System.gc();
    +                 }
    +             },
    +             "十点上新" = { -- 十点上新 cell 样式
    +                 Size = ^(section, row){ -- 每个Cell 尺寸
    +                     return scrW , NOTICE_CELL_H;
    +                 },
    +                 Init = ^(cell){
    +                    local cellW, cellH = window.size();
    +
    +                    cell.line = UILabel();
    +                    cell.line.setFrame(0,0,scrW-20,1);
    +                    cell.line.center(cellW/2, cellH/2);
    +                    cell.line.setBackgroundColor(0x333333);
    +
    +                    cell.label = UILabel();
    +                    cell.label.setFrame(0, 0, cellW, cellH);
    +                    cell.label.setFont(14);
    +                    cell.label.setTextAlignment(TextAlignmentCenter);
    +                    window.setBackgroundColor(0xeeeeee);
    +                    cell.label.setBackgroundColor(0xeeeeee);
    +                 },
    +                 Layout = ^(cell , section, row){
    +                     local cellW, cellH = window.size();
    +                     local theBrandMind = getOptionTheBrandMind(i);
    +                     cell.label.setText(theBrandMind );
    +                     cell.label.sizeToFit();
    +                     local w,h = cell.label.size();
    +                     w = w + 20*2;
    +                     cell.label.size(w,h);
    +                     cell.label.center(cellW/2, cellH/2);
    +                 },
    +                 Select = ^(section, row){
    +                     print(section, row);
    +                     System.gc();
    +                 }
    +             }
    +         },
    +         HeaderBeginRefreshing = ^(){ -- 开始下拉刷新回调
    +             print("HeaderRefresh");
    +             option.requestItems(^(){
    +                     local collectionView = tableViewArray[i];
    +                     collectionView.reloadData();
    +                     collectionView.headerEndRefreshing();
    +                 });
    +         },
    +         FooterBeginRefreshing = ^(){ -- 加载更多回调
    +             print("FooterRefresh");
    +         }
    +     };
    +     collectionView.setMiniSpacing(5); -- 设置最小间距
    +     local barH = 40;
    +     collectionView.setFrame( (i-1)*scrW, barH, scrW, scrH-barH);
    +     collectionView.backgroundColor(0xeeeeee);
    +     collectionView.initRefreshHeader();
    +
    +    
  • +
+ +
+
+ + reloadData () +
+
+ 重新加载刷新UICollectionView + + + + + + + +
+
+ + rectForSection (section, row) +
+
+ 获取给定section row 所在区域的位置大小 + + +

参数:

+
    +
  • section + number + + + +
  • +
  • row + number + + + +
  • +
+ +

返回值:

+
    +
  1. + number + x x坐标
  2. +
  3. + number + y y坐标
  4. +
  5. + number + w 宽
  6. +
  7. + number + h 高
  8. +
+ + + + +
+
+ + setMiniSpacing (miniSpacing) +
+
+ 设置最小间距 + + +

参数:

+
    +
  • miniSpacing + number + 最小间距 +
  • +
+ + + + + +
+
+ + miniSpacing () +
+
+ 获取最小间距 + + + +

返回值:

+
    + + number + miniSpacing 最小间距 +
+ + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/UIErrorView.html" "b/Doc/API/\347\261\273/UIErrorView.html" new file mode 100644 index 00000000..eca862d6 --- /dev/null +++ "b/Doc/API/\347\261\273/UIErrorView.html" @@ -0,0 +1,194 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class UIErrorView

+

错误提示框样式 + native可定制

+

UIErrorView的父类是UIView

+ + +

全局函数

+ + + + + +
UIErrorView ()通过这个方法创建一个UIErrorView对象
+

实例方法

+ + + + + +
setDelegate (delegate)设置delegate
+ +
+
+ + +

全局函数

+ +
+
+ + UIErrorView () +
+
+ 通过这个方法创建一个UIErrorView对象 + + + +

返回值:

+
    + + UIErrorView + view +
+ + + +

例子:

+
    +
    local errorView = UIErrorView();
    +
+ +
+
+

实例方法

+ +
+
+ + setDelegate (delegate) +
+
+ 设置delegate + + +

参数:

+
    +
  • delegate + function + 代理方法 +
  • +
+ + + + +

例子:

+
    +
     errorView.setDelegate( function(){
    +     -- code
    + } );
    +
    + --或者:
    + errorView.delegate( function(){
    +    -- code
    + } );
    +
    + --或者:
    + errorView.delegate = function(){
    +     -- code
    + };
    +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/UIImageView.html" "b/Doc/API/\347\261\273/UIImageView.html" new file mode 100644 index 00000000..b59e96cc --- /dev/null +++ "b/Doc/API/\347\261\273/UIImageView.html" @@ -0,0 +1,313 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class UIImageView

+

UIImageView + 放图片的View

+

UIImageView的父类是UIView

+ + +

全局函数

+ + + + + +
UIImageView ()通过这个方法创建一个UIImageView对象
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + +
setImage (url)设置ImageView的图片url
setContentMode (contentMode)设置图片的缩放模式
startAnimating (images, duration, repeatCount)开始帧动画
stopAnimating ()停止帧动画
isAnimating ()是否正在播放帧动画
+ +
+
+ + +

全局函数

+ +
+
+ + UIImageView () +
+
+ 通过这个方法创建一个UIImageView对象 + + + +

返回值:

+
    + + UIImageView + view +
+ + + +

例子:

+
    +
    local view = UIImageView();
    +
+ +
+
+

实例方法

+ +
+
+ + setImage (url) +
+
+ 设置ImageView的图片url + + +

参数:

+
    +
  • url + string + image url +
  • +
+ + + + +

例子:

+
    +
    local view = UIImageView();
    + view.setImage("https://gju2.alicdn.com/bao/uploaded/TB25bF4eFXXXXbzXpXXXXXXXXXX_!!0-0-juitemmedia.jpg_560x560Q90.jpg");
    +
+ +
+
+ + setContentMode (contentMode) +
+
+ 设置图片的缩放模式 + + +

参数:

+
    +
  • contentMode + int + 填充模式 +
  • +
+ + + + +

例子:

+
    +
    + -- UIViewContentModeScaleToFill = 0,
    + -- UIViewContentModeScaleAspectFit = 1, -- contents scaled to fit with fixed aspect. remainder is transparent
    + -- UIViewContentModeScaleAspectFill = 2,
    + local view = UIImageView();
    + view.setContentMode(1);
    +
+ +
+
+ + startAnimating (images, duration, repeatCount) +
+
+ 开始帧动画 + + +

参数:

+
    +
  • images + array + 帧图片数组 +
  • +
  • duration + number + 动画时间 +
  • +
  • repeatCount + int + 重复次数 +
  • +
+ + + + +

例子:

+
    +
    + w,h = System.screenSize();
    + window.setFrame(0, 0, w, h);
    + window.setUserInteractionEnabled(true);
    + window.setBackgroundColor(0xffffff,1);
    + imageView = UIImageView();
    + imageView.setFrame(0,30,100,100);
    + imageView.setBackgroundColor(0xff0000,1);
    + names = {};
    + for i=1,16 do
    + 	  names[i] = "" .. i .. ".tiff"
    + end
    + imageView.setImage("16.tiff");
    + imageView.startAnimating( names, 3.0, 1);
    +
+ +
+
+ + stopAnimating () +
+
+ 停止帧动画 + + + + + + +

例子:

+
    +
    imageView.stopAnimating();
    +
+ +
+
+ + isAnimating () +
+
+ 是否正在播放帧动画 + + + +

返回值:

+
    + + bool + 是否正在播放帧动画 +
+ + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/UILabel.html" "b/Doc/API/\347\261\273/UILabel.html" new file mode 100644 index 00000000..bc367b6e --- /dev/null +++ "b/Doc/API/\347\261\273/UILabel.html" @@ -0,0 +1,444 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class UILabel

+

UILabel + 放文本的View, 类似安卓的TextView

+

UILabel的父类是UIView

+ + +

全局函数

+ + + + + +
UILabel ()通过这个全局静态函数 构建一个新的UILabel对象
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
setText (text)设置Label文本信息
text ()获取Label文本
setTextColor (color, alpha)设置Label文本颜色
textColor ()获取Label文本颜色
setFont (fontName, fontSize)设置Label字体
font ()获取Label字体
setTextAlignment (align)设置Label文本对齐方式
textAlignment ()获取Label文本对齐方式
setNumberOfLines (num)设置Label最多行数
numberOfLines ()获取Label最多行数
adjustsFontSizeToFitWidth ()让Label字体大小适应宽度, 设置的字体为最大字体, 如果文字超出会缩小字体.
+ +
+
+ + +

全局函数

+ +
+
+ + UILabel () +
+
+ 通过这个全局静态函数 构建一个新的UILabel对象 + + + +

返回值:

+
    + + UILabel + label +
+ + + + +
+
+

实例方法

+ +
+
+ + setText (text) +
+
+ 设置Label文本信息 + + +

参数:

+
    +
  • text + string + 文本 +
  • +
+ + + + +

例子:

+
    +
     local label = UILabel();
    + label.setText("测试");
    + label.text("测试");
    + label.text = "测试";
    +      
    +
+ +
+
+ + text () +
+
+ 获取Label文本 + + + +

返回值:

+
    + + string + text 文本 +
+ + + + +
+
+ + setTextColor (color, alpha) +
+
+ 设置Label文本颜色 + + +

参数:

+
    +
  • color + int + 色值 +
  • +
  • alpha + number + 透明度 +
  • +
+ + + + + +
+
+ + textColor () +
+
+ 获取Label文本颜色 + + + +

返回值:

+
    +
  1. + int + color 色值
  2. +
  3. + number + alpha 透明度
  4. +
+ + + + +
+
+ + setFont (fontName, fontSize) +
+
+ 设置Label字体 + + +

参数:

+
    +
  • fontName + string + 可选参数 +
  • +
  • fontSize + number + + + +
  • +
+ + + + + +
+
+ + font () +
+
+ 获取Label字体 + + + +

返回值:

+
    +
  1. + string + fontName
  2. +
  3. + number + fontSize
  4. +
+ + + + +
+
+ + setTextAlignment (align) +
+
+ 设置Label文本对齐方式 + + +

参数:

+
    +
  • align + int + 可选参数 +
  • +
+ + + + +

例子:

+
    +
     TextAlignment
    + NSTextAlignmentLeft      = 0,    -- Visually left aligned
    + NSTextAlignmentCenter    = 1,    -- Visually centered
    + NSTextAlignmentRight     = 2,    -- Visually right aligned
    +      
    +
+ +
+
+ + textAlignment () +
+
+ 获取Label文本对齐方式 + + + +

返回值:

+
    + + int + align对齐方式 +
+ + + + +
+
+ + setNumberOfLines (num) +
+
+ 设置Label最多行数 + + +

参数:

+
    +
  • num + int + 行数 +
  • +
+ + + + + +
+
+ + numberOfLines () +
+
+ 获取Label最多行数 + + + +

返回值:

+
    + + int + num 行数 +
+ + + + +
+
+ + adjustsFontSizeToFitWidth () +
+
+ 让Label字体大小适应宽度, 设置的字体为最大字体, 如果文字超出会缩小字体. + + + + + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/UILoadingPage.html" "b/Doc/API/\347\261\273/UILoadingPage.html" new file mode 100644 index 00000000..790c28e2 --- /dev/null +++ "b/Doc/API/\347\261\273/UILoadingPage.html" @@ -0,0 +1,147 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class UILoadingPage

+

加载中提示框样式 + native可定制

+

UILoadingPage的父类是UIView

+ + +

全局函数

+ + + + + +
UILoadingPage ()通过这个方法创建一个UILoadingPage对象
+ +
+
+ + +

全局函数

+ +
+
+ + UILoadingPage () +
+
+ 通过这个方法创建一个UILoadingPage对象 + + + +

返回值:

+
    + + UILoadingPage + view +
+ + + +

例子:

+
    +
    local view = UILoadingPage();
    +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/UILoadingView.html" "b/Doc/API/\347\261\273/UILoadingView.html" new file mode 100644 index 00000000..317ad12a --- /dev/null +++ "b/Doc/API/\347\261\273/UILoadingView.html" @@ -0,0 +1,266 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class UILoadingView

+

菊花, 活动状体指示器

+

UILoadingView的父类是UIView

+ + +

全局函数

+ + + + + +
UILoadingView ()创建一个UILoadingView对象
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + +
startAnimating ()菊花开始转动
stopAnimating ()菊花停止转动
isAnimating ()菊花是否转动中
setColor (color, alpha)设置菊花颜色
color ()获取菊花颜色
+ +
+
+ + +

全局函数

+ +
+
+ + UILoadingView () +
+
+ 创建一个UILoadingView对象 + + + +

返回值:

+
    + + UILoadingView + view +
+ + + +

例子:

+
    +
    local view = UILoadingView();
    +
+ +
+
+

实例方法

+ +
+
+ + startAnimating () +
+
+ 菊花开始转动 + + + + + + + +
+
+ + stopAnimating () +
+
+ 菊花停止转动 + + + + + + + +
+
+ + isAnimating () +
+
+ 菊花是否转动中 + + + + + + + +
+
+ + setColor (color, alpha) +
+
+ 设置菊花颜色 + + +

参数:

+
    +
  • color + int + + + +
  • +
  • alpha + number + + + +
  • +
+ + + + + +
+
+ + color () +
+
+ 获取菊花颜色 + + + +

返回值:

+
    +
  1. + int + color
  2. +
  3. + number + alpha
  4. +
+ + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/UINotice.html" "b/Doc/API/\347\261\273/UINotice.html" new file mode 100644 index 00000000..03bce48f --- /dev/null +++ "b/Doc/API/\347\261\273/UINotice.html" @@ -0,0 +1,157 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class UINotice

+

UINotice + 会自动消失的提示框样式(Native可定制)

+

UINotice的父类是UIView

+

Info:

+
    +
  • Author: 聚划算无线
  • +
+ + +

全局函数

+ + + + + +
UINotice (info)创建提示框对象
+ +
+
+ + +

全局函数

+ +
+
+ + UINotice (info) +
+
+ 创建提示框对象 + + +

参数:

+
    +
  • info + string + 提示信息 +
  • +
+ +

返回值:

+
    + + UINotice + view +
+ + + +

例子:

+
    +
    local view = UINotice("请检查网络");
    +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/UIPageControl.html" "b/Doc/API/\347\261\273/UIPageControl.html" new file mode 100644 index 00000000..b4c2b805 --- /dev/null +++ "b/Doc/API/\347\261\273/UIPageControl.html" @@ -0,0 +1,375 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class UIPageControl

+

UIPageControl + banner滚动第几页的小圆点

+

UIPageControl的父类是UIView

+ + +

全局函数

+ + + + + +
UIPageControl ()创建一个UIPageControl对象
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
setNumberOfPages (num)设置总页数
numberOfPages ()获取总页数
setCurrentPage (page)设置当前选中页
currentPage ()获取当前选中页
setPageColor (color, alpha)设置未选中页的颜色
pageColor ()获取未选中页的颜色
setCurrentPageColor (color, alpha)设置选中页的颜色
currentPageColor ()获取选中页的颜色
+ +
+
+ + +

全局函数

+ +
+
+ + UIPageControl () +
+
+ 创建一个UIPageControl对象 + + + +

返回值:

+
    + + UIPageControl + pageControl +
+ + + +

例子:

+
    +
    local pageControl = UIPageControl();
    +
+ +
+
+

实例方法

+ +
+
+ + setNumberOfPages (num) +
+
+ 设置总页数 + + +

参数:

+
    +
  • num + int + + + +
  • +
+ + + + + +
+
+ + numberOfPages () +
+
+ 获取总页数 + + + +

返回值:

+
    + + int + num +
+ + + + +
+
+ + setCurrentPage (page) +
+
+ 设置当前选中页 + + +

参数:

+
    +
  • page + int + + + +
  • +
+ + + + + +
+
+ + currentPage () +
+
+ 获取当前选中页 + + + +

返回值:

+
    + + int + page +
+ + + + +
+
+ + setPageColor (color, alpha) +
+
+ 设置未选中页的颜色 + + +

参数:

+
    +
  • color + int + + + +
  • +
  • alpha + number + + + +
  • +
+ + + + + +
+
+ + pageColor () +
+
+ 获取未选中页的颜色 + + + +

返回值:

+
    +
  1. + int + color
  2. +
  3. + number + alpha
  4. +
+ + + + +
+
+ + setCurrentPageColor (color, alpha) +
+
+ 设置选中页的颜色 + + +

参数:

+
    +
  • color + int + + + +
  • +
  • alpha + number + + + +
  • +
+ + + + + +
+
+ + currentPageColor () +
+
+ 获取选中页的颜色 + + + +

返回值:

+
    +
  1. + int + color
  2. +
  3. + number + alpha
  4. +
+ + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/UIPageView.html" "b/Doc/API/\347\261\273/UIPageView.html" new file mode 100644 index 00000000..568ee287 --- /dev/null +++ "b/Doc/API/\347\261\273/UIPageView.html" @@ -0,0 +1,316 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class UIPageView

+

UIPageView + 横向分页滚动的View

+

UIPageView的父类是UIView

+ + +

全局函数

+ + + + + + + + + +
UIPageView (delegate)创建一个UIPageView对象
UIPageView ()创建TabelView
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + + + + + +
setPageCount ()设置页面数量
pageCount ()获取页面数量
setCurrentPage ()设置当前页面
currentPage ()获取当前页面
setDelegate ()设置代理
reload ()重新加载PageView
+ +
+
+ + +

全局函数

+ +
+
+ + UIPageView (delegate) +
+
+ 创建一个UIPageView对象 + + +

参数:

+
    +
  • delegate + table + 参数 +
  • +
+ +

返回值:

+
    + + UIPageView + pageView +
+ + + +

例子:

+
    +
     local pageView = UIPageView();
    + require "lv_kit"
    +
    + local width, height= System.screenSize()
    +
    + pageView = UIPageView({
    +     PageCount = 12,
    +     Pages = {
    +         Init = function(page, pos)
    +             page.icon = UIButton()
    +         end,
    +         Layout = function(page, pos)
    +             page.icon.setText("测试按钮"..pos)
    +             page.icon.setFrame(0, 0, width, 200)
    +         end
    +     },
    +     Callback = {
    +
    +         Scrolling = function( pageIndex, percent , offset )
    +             print("Scrolling", pageIndex, percent, offset)
    +         end,
    +
    +         ScrollEnd = function( pageIndex )
    +             print("ScrollEnd", pageIndex )
    +         end
    +
    +     }
    + })
    +
    + windowWidth , windowHeight = window.size();
    + pageView.setFrame(0,0,windowWidth,windowHeight-64)
    +
+ +
+
+ + UIPageView () +
+
+ 创建TabelView + + + + + + + +
+
+

实例方法

+ +
+
+ + setPageCount () +
+
+ 设置页面数量 + + + + + + + +
+
+ + pageCount () +
+
+ 获取页面数量 + + + + + + + +
+
+ + setCurrentPage () +
+
+ 设置当前页面 + + + + + + + +
+
+ + currentPage () +
+
+ 获取当前页面 + + + + + + + +
+
+ + setDelegate () +
+
+ 设置代理 + + + + + + + +
+
+ + reload () +
+
+ 重新加载PageView + + + + + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/UIScrollView.html" "b/Doc/API/\347\261\273/UIScrollView.html" new file mode 100644 index 00000000..481c6762 --- /dev/null +++ "b/Doc/API/\347\261\273/UIScrollView.html" @@ -0,0 +1,747 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class UIScrollView

+

UIScrollView + 可滚动的View

+

UIScrollView的父类是UIView, 子类有UITableView, UICollectionView

+ + +

全局函数

+ + + + + +
UIScrollView ()通过这个方法创建一个UIScrollView对象
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
setDelegate (delegate)设置delegate
setContentSize (w, h)设置ContentSize大小
contentSize ()获取ContentSize大小
setContentOffset (x, y, animation)设置ContentSize大小
contentOffset ()获取contentOffset大小
setContentInset (top, left, bottom, right)设置setContentInset
contentInset ()获取contentInset
setScrollIndicatorInsets (top, left, bottom, right)设置setContentInset
scrollIndicatorInsets ()获取contentInset
setPageEnable (pageEnable)设置分页滚动
pageEnable ()获取是否分页滚动
setShowScrollIndicator (showsHorizontal, showsVertical)设置是否显示滚动条
showScrollIndicator ()获取是否显示滚动条信息
startRefreshing ()代码控制 开始下拉刷新动画
stopRefreshing ()停止下拉刷新动画(数据已经加载完成后调用)
initPullUpRefreshing ()开启上拉加载更多功能
removePullUpRefreshing ()关闭 上拉加载更多功能
pullUpNoticeNoMoreData ()上拉加载更多 提示没有更多数据的状态
resetPullUpRefreshing ()重置 上拉加载更多功能
scrollRectToVisible (x, y, w, h, animate)滚动到指定位置
+ +
+
+ + +

全局函数

+ +
+
+ + UIScrollView () +
+
+ 通过这个方法创建一个UIScrollView对象 + + + +

返回值:

+
    + + UIScrollView + view +
+ + + + +
+
+

实例方法

+ +
+
+ + setDelegate (delegate) +
+
+ 设置delegate + + +

参数:

+
    +
  • delegate + table + 代理方法 +
  • +
+ + + + +

例子:

+
    +
  • + --例子一:
    + scrollView.setDelegate( function(){
    +     -- code
    + } );
    +
    + --或者:
    + scrollView.delegate( function(){
    +    -- code
    + } );
    +
    + --或者:
    + scrollView.delegate = function(){
    +     -- code
    + };
  • +
  • + --例子二:
    + local scrW, scrH = System.screenSize();
    + scrollView = UIScrollView();
    + scrollView.setBackgroundColor(0xffFFFF);
    + scrollView.setFrame(0, 0, scrW, imageH );
    + scrollView.setPageEnable(true);
    + scrollView.showScrollIndicator(false,false);
    + scrollView.delegate = {
    +     Refresh = {
    +         PullDown=^(){
    +             -- 开始下拉刷新回调
    +         },
    +         PullUp = ^(){
    +             -- 开始上拉刷新回调
    +         }
    +     },
    +     Scroll = {
    +         Scrolling=^(){
    +             -- 滚动中
    +         },
    +         Begin = ^(){
    +             -- 开始滚动
    +         },
    +         End=^(){
    +             -- 结束滚动
    +         }
    +     }
    +  };
  • +
+ +
+
+ + setContentSize (w, h) +
+
+ 设置ContentSize大小 + + +

参数:

+
    +
  • w + number + 宽 +
  • +
  • h + number + 高 +
  • +
+ + + + + +
+
+ + contentSize () +
+
+ 获取ContentSize大小 + + + +

返回值:

+
    +
  1. + number + w 宽
  2. +
  3. + number + h 高
  4. +
+ + + + +
+
+ + setContentOffset (x, y, animation) +
+
+ 设置ContentSize大小 + + +

参数:

+
    +
  • x + number + x滚动偏移位置 +
  • +
  • y + number + y滚动偏移位置 +
  • +
  • animation + bool + 是否动画 参数可以省略 +
  • +
+ + + + + +
+
+ + contentOffset () +
+
+ 获取contentOffset大小 + + + +

返回值:

+
    +
  1. + number + x
  2. +
  3. + number + y
  4. +
+ + + + +
+
+ + setContentInset (top, left, bottom, right) +
+
+ 设置setContentInset + + +

参数:

+
    +
  • top + number + + + +
  • +
  • left + number + + + +
  • +
  • bottom + number + + + +
  • +
  • right + number + + + +
  • +
+ + + + + +
+
+ + contentInset () +
+
+ 获取contentInset + + + +

返回值:

+
    +
  1. + number + top
  2. +
  3. + number + left
  4. +
  5. + number + bottom
  6. +
  7. + number + right
  8. +
+ + + + +
+
+ + setScrollIndicatorInsets (top, left, bottom, right) +
+
+ 设置setContentInset + + +

参数:

+
    +
  • top + number + + + +
  • +
  • left + number + + + +
  • +
  • bottom + number + + + +
  • +
  • right + number + + + +
  • +
+ + + + + +
+
+ + scrollIndicatorInsets () +
+
+ 获取contentInset + + + +

返回值:

+
    +
  1. + number + top
  2. +
  3. + number + left
  4. +
  5. + number + bottom
  6. +
  7. + number + right
  8. +
+ + + + +
+
+ + setPageEnable (pageEnable) +
+
+ 设置分页滚动 + + +

参数:

+
    +
  • pageEnable + bool + 是否分页滚动 +
  • +
+ + + + + +
+
+ + pageEnable () +
+
+ 获取是否分页滚动 + + + +

返回值:

+
    + + bool + pageEnable +
+ + + + +
+
+ + setShowScrollIndicator (showsHorizontal, showsVertical) +
+
+ 设置是否显示滚动条 + + +

参数:

+
    +
  • showsHorizontal + bool + 显示水平滚动条 +
  • +
  • showsVertical + bool + 显示纵向滚动条 +
  • +
+ + + + + +
+
+ + showScrollIndicator () +
+
+ 获取是否显示滚动条信息 + + + +

返回值:

+
    +
  1. + bool + showsHorizontal 显示水平滚动条
  2. +
  3. + bool + showsVertical 显示纵向滚动条
  4. +
+ + + + +
+
+ + startRefreshing () +
+
+ 代码控制 开始下拉刷新动画 + + + + + + + +
+
+ + stopRefreshing () +
+
+ 停止下拉刷新动画(数据已经加载完成后调用) + + + + + + + +
+
+ + initPullUpRefreshing () +
+
+ 开启上拉加载更多功能 + + + + + + + +
+
+ + removePullUpRefreshing () +
+
+ 关闭 上拉加载更多功能 + + + + + + + +
+
+ + pullUpNoticeNoMoreData () +
+
+ 上拉加载更多 提示没有更多数据的状态 + + + + + + + +
+
+ + resetPullUpRefreshing () +
+
+ 重置 上拉加载更多功能 + + + + + + + +
+
+ + scrollRectToVisible (x, y, w, h, animate) +
+
+ 滚动到指定位置 + + +

参数:

+
    +
  • x + number + x坐标 +
  • +
  • y + number + y坐标 +
  • +
  • w + number + 宽 +
  • +
  • h + number + 高 +
  • +
  • animate + bool + 是否动画 切换 +
  • +
+ + + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/UITableView.html" "b/Doc/API/\347\261\273/UITableView.html" new file mode 100644 index 00000000..b2821ba5 --- /dev/null +++ "b/Doc/API/\347\261\273/UITableView.html" @@ -0,0 +1,544 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class UITableView

+

UITableView + 每行高度样式可定制和重复利用的列表

+

UITableView的父类是UIScrollView

+ + +

全局函数

+ + + + + +
UITableView ()通过这个方法创建一个UITableView对象
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
setDelegate (delegate)设置TableView代理
reload ()重新刷新加载TableView
setHeader ()设置TableView的头
setFooter ()设置TableView的尾
rectForSection (section, row)获取某个section,row所在的位置区域大小
initPullDownRefresh ()开启下拉刷新功能
removePullDownRefreshing ()关闭下拉刷新功能
beginPullDownRefreshing ()代码控制 开始下拉刷新动画
endPullDownRefreshing ()停止下拉刷新动画(数据已经加载完成后调用)
initPullUpRefreshing ()开启上拉加载更多功能
removePullUpRefreshing ()关闭 上拉加载更多功能
pullUpNoticeNoMoreData ()上拉加载更多 提示没有更多数据的状态
resetPullUpRefreshing ()重置 上拉加载更多功能
+ +
+
+ + +

全局函数

+ +
+
+ + UITableView () +
+
+ 通过这个方法创建一个UITableView对象 + + + +

返回值:

+
    + + UITableView + view +
+ + + +

例子:

+
    +
    local view = UITableView();
    +
+ +
+
+

实例方法

+ +
+
+ + setDelegate (delegate) +
+
+ 设置TableView代理 + + +

参数:

+
    +
  • delegate + table + 代理 +
  • +
+ + + + +

例子:

+
    +
  •  -- 例子一:
    + local tableView = UITableView();
    + tableView.setDelegate( {
    +	    -- code
    +	} );
    + 或者:
    + local tableView = UITableView();
    + tableView.delegate( {
    +	    -- code
    +	} );
    + 或者:
    + local tableView = UITableView();
    + tableView.delegate =  {
    +	    -- code
    +	};
    + 或者:
    + local tableView = UITableView(  {
    +	    -- code
    +	} );
    +
    + 或者:
    + local tableView = UITableView{
    +	    -- code
    +	};
    +     
  • +
  •   -- 例子二:
    + print("初始化窗口大小, 默认窗口大小是(0,0)");
    + w,h = System.screenSize();
    + window.setFrame(0, 0, w, h);
    + window.setUserInteractionEnabled(true);
    + window.setBackgroundColor(0,1);
    + cellHeight = 100
    + imageUrl1 = "http://gju2.alicdn.com/bao/uploaded/i1/10000073270926575/TB2fpg0cXXXXXb6XpXXXXXXXXXX_!!0-0-juitemmedia.jpg"
    + imageUrl2 = "http://img4.duitang.com/uploads/item/201306/25/20130625045508_sairr.thumb.600_0.jpeg"
    +
    + tableView = UITableView();
    + tableView.delegate = {
    +     Section = {
    +         NumberOfSections = 2, -- section数量
    +
    +         NumberOfRows = ^(section){ -- 每个section的行数
    +             return 10;
    +         }
    +     },
    +
    +     Cell = {
    +         Id = ^( section, row ){ -- 指定section和row对应的Cell类型唯一识别号
    +             return  "图片+文字";
    +         }
    +         "图片+文字" = { -- cell 具体样式
    +             Height = ^( section, row ){ -- 指定section和row 对应的高度
    +                 return cellHeight;
    +             }
    +             Init = ^(cell, section, row){ -- 初始化cell
    +                 cell.icon = UIImageView();
    +                 cell.title = UILabel();
    +                 print("构造Cell");
    +             },
    +             Layout = ^(cell, section, row){ -- cell复用时调用
    +                 cell.icon.setFrame(0, 0, cellHeight, cellHeight);
    +                 cell.icon.setImage(imageUrl1);
    +
    +                 cell.title.setFrame(cellHeight, 0, w-cellHeight, cellHeight);
    +                cell.title.setText("测试"..section .."--" .. row);
    +             },
    +             Delegate = ^(cell, section, row ){ -- 用户点击了section和row
    +                 print(section, row);
    +                 row = row %4;
    +                 if( row ==0 ) {
    +                     tableView.headerEndRefreshing();
    +                 } else if (row ==1 ) {
    +                     tableView.footerNoticeNoMoreData();
    +                 } else if ( row == 2 ) {
    +                     tableView.hiddenRefreshFooter(true);
    +                 }
    +                 -- tableView.reloadData();
    +                 System.gc();
    +             }
    +     },
    +     Refresh = {
    +         PullDown=^(){
    +             -- 开始下拉刷新回调
    +         },
    +         PullUp = ^(){
    +             -- 开始上拉刷新回调
    +         }
    +     },
    +     Scroll = {
    +         Scrolling=^(){
    +             -- 滚动中
    +         },
    +         Begin = ^(){
    +             -- 开始滚动
    +         },
    +         End=^(){
    +             -- 结束滚动
    +         }
    +     }
    + };
    +
    + loading = false;
    +
    + tableView.setFrame(0,50,w,h-100);
    + tableView.setBackgroundColor(0xffFFFF);
    +
    + tableView.initRefreshHeader();
    + tableView.initRefreshFooter();
    +
    + local head = UIButton();
    + head.setTitle("我是头");
    + head.setFrame(0,0,w,100);
    + head.setBackgroundColor(0xff);
    + tableView.setHeader( head );
    +
    + local foot = UIButton();
    + foot.setTitle("我是结尾");
    + foot.setFrame(0,0,w,100);
    + foot.setBackgroundColor(0xff0000);
    + tableView.setFooter( foot );
    +    
  • +
+ +
+
+ + reload () +
+
+ 重新刷新加载TableView + + + + + + + +
+
+ + setHeader () +
+
+ 设置TableView的头 + + + + + + + +
+
+ + setFooter () +
+
+ 设置TableView的尾 + + + + + + + +
+
+ + rectForSection (section, row) +
+
+ 获取某个section,row所在的位置区域大小 + + +

参数:

+
    +
  • section + int + section +
  • +
  • row + int + row +
  • +
+ +

返回值:

+
    +
  1. + number + x
  2. +
  3. + number + y
  4. +
  5. + number + w
  6. +
  7. + number + h
  8. +
+ + + + +
+
+ + initPullDownRefresh () +
+
+ 开启下拉刷新功能 + + + + + + + +
+
+ + removePullDownRefreshing () +
+
+ 关闭下拉刷新功能 + + + + + + + +
+
+ + beginPullDownRefreshing () +
+
+ 代码控制 开始下拉刷新动画 + + + + + + + +
+
+ + endPullDownRefreshing () +
+
+ 停止下拉刷新动画(数据已经加载完成后调用) + + + + + + + +
+
+ + initPullUpRefreshing () +
+
+ 开启上拉加载更多功能 + + + + + + + +
+
+ + removePullUpRefreshing () +
+
+ 关闭 上拉加载更多功能 + + + + + + + +
+
+ + pullUpNoticeNoMoreData () +
+
+ 上拉加载更多 提示没有更多数据的状态 + + + + + + + +
+
+ + resetPullUpRefreshing () +
+
+ 重置 上拉加载更多功能 + + + + + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/UITextField.html" "b/Doc/API/\347\261\273/UITextField.html" new file mode 100644 index 00000000..caf4e941 --- /dev/null +++ "b/Doc/API/\347\261\273/UITextField.html" @@ -0,0 +1,319 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class UITextField

+

UITextField + 文本输入框

+

UITextField的父类是UIView

+ + +

全局函数

+ + + + + +
UITextField ()通过这个方法创建一个UITextField对象
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + +
setText (s)设置文本内容
text ()获取文本内容
setPlaceholder (s)设置palceHolder那日
placeholder ()获取placeHolder内容
setDelegate (delegate)设置delegate
+ +
+
+ + +

全局函数

+ +
+
+ + UITextField () +
+
+ 通过这个方法创建一个UITextField对象 + + + +

返回值:

+
    + + UITextField + textField +
+ + + +

例子:

+
    +
    local textField = UITextField();
    +
+ +
+
+

实例方法

+ +
+
+ + setText (s) +
+
+ 设置文本内容 + + +

参数:

+ + + + + + +
+
+ + text () +
+
+ 获取文本内容 + + + +

返回值:

+
    + + string + s text +
+ + + + +
+
+ + setPlaceholder (s) +
+
+ 设置palceHolder那日 + + +

参数:

+ + + + + + +
+
+ + placeholder () +
+
+ 获取placeHolder内容 + + + +

返回值:

+
    + + string + s text +
+ + + + +
+
+ + setDelegate (delegate) +
+
+ 设置delegate + + +

参数:

+
    +
  • delegate + function + 代理方法 +
  • +
+ + + + +

例子:

+
    +
     button.setDelegate(
    +    {
    +         BeginEditing = ^(){ --开始编辑
    +         },
    +         EndEditing = ^(){ -- 结束编辑
    +         },
    +         Clear = ^(){ -- 清理
    +         },
    +         Return = ^(){ --返回
    +         }
    +    }
    + );
    +
    + --或者:
    + button.delegate(
    +    {
    +         BeginEditing = ^(){ --开始编辑
    +         },
    +         EndEditing = ^(){ -- 结束编辑
    +         },
    +         Clear = ^(){ -- 清理
    +         },
    +         Return = ^(){ --返回
    +         }
    +    }
    +  );
    +
    + --或者:
    + button.delegate =
    +    {
    +         BeginEditing = ^(){ --开始编辑
    +         },
    +         EndEditing = ^(){ -- 结束编辑
    +         },
    +         Clear = ^(){ -- 清理
    +         },
    +         Return = ^(){ --返回
    +         }
    +    } ;
    +   
    +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/UIView.html" "b/Doc/API/\347\261\273/UIView.html" new file mode 100644 index 00000000..2bf09aab --- /dev/null +++ "b/Doc/API/\347\261\273/UIView.html" @@ -0,0 +1,2546 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class UIView

+

UIView + 所有UI控件的基类

+

+ +

+ + +

全局函数

+ + + + + +
UIView ()通过这个方法创建一个UIView对象
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
setFrame (x, y, w, h)设置View的位置和大小
frame ()获取View的位置和大小
setBackgroundColor (color, alpha)设置View的背景色
backgroundColor ()获取View的背景色
setSize (w, h)设置View的大小
size ()获取View的大小
setOrigin (x, y)设置View的位置
orgrin ()获取View的位置
setCenter (x, y)设置View的中心点位置
center ()获取View的中心点位置
setX (x)设置View的x坐标
x ()获取View的x坐标
setY (y)设置View的y坐标
y ()获取View的y坐标
setTop (y)设置View的y坐标
top ()获取View的y坐标
setLeft (x)设置View的x位置
left ()获取View的x坐标
setBottom (bottom)设置View的bottom坐标
bottom ()获取View的bottom坐标
setRight (right)设置View的right位置
rigth ()获取View的right坐标
setWidth (w)设置View的宽
width ()获取View的宽
setHeight (h)设置View的高
height ()获取View的高
setCenterX (x)设置View的中心点x坐标
centerX ()获取View的中心点x坐标
setCenterY (y)设置View的中心点y坐标
centerY ()获取View的中心点y坐标
setHidden (hidden)设置可见状态
hidden ()获取可见状态
setEnabled (enable)设置View enable控制是否收触摸事件
enabled ()获取View enable状态
setAlpha (alpha)设置alpha值
alpha ()获取alpha值
setCornerRadius (radius)设置边框圆角半径
cornerRadius ()获取边框圆角半径
setBorderWidth (borderWidth)设置边框粗细
borderWidth ()获取边框粗细
setBorderColor (color, alpha)设置边框颜色
borderColor ()获取边框颜色
setClipsToBounds (clipsToBounds)设置View边框是否剪接
clipsToBounds ()获取View边框是否剪接
setShadowPath (shadowPath)设置 只对边框外部加阴影
setMasksToBounds (masksToBounds)设置边框是否裁剪
setShadowOffset (x, y)设置View阴影偏移位置
setShadowRadius (r)设置View阴影高斯模糊半径
setShadowOpacity (alpha)设置View阴影透明度
setShadowColor (color, alpha)设置View阴影颜色
sizeToFit ()适应View内容的大小
addGestureRecognizer (gestureRecognizer)添加手势
removeGestureRecognizer (gestureRecognizer)移除手势
addView (view)添加子类
removeFromSuper ()从父类中移除自身
removeAllViews ()移除所有子类
setRotation (angle)设置view 绕Z轴旋转弧度
rotation (angle)获取view绕Z轴旋转弧度
setRotationX (angle)设置view 绕X轴旋转弧度
rotationX (angle)获取view绕X轴旋转弧度
setRotationY (angle)设置view 绕Y轴旋转弧度
rotationY (angle)获取view绕Y轴旋转弧度
setScale (scaleX, scaleY)设置view缩放
scale ()获取view X轴 Y轴 缩放
setScaleX (scaleX)设置view X轴缩放
scaleX ()获取view缩放
setScaleY (scaleY)设置view Y轴缩放
scaleY ()获取view缩放
setTransform3D (transform3D)设置3D变换矩阵
setAnchorPoint (x, y)设置中心点位置
anchorPoint ()获取中心点位置
setDelegate (delegate)设置delegate
isFirstResponder ()是否FirstResponder
becomeFirstResponder ()设置为FirstResponder
resignFirstResponder ()取消FirstResponder
hasFocus ()是否 Focus
requestFocus ()focus
cancelFocus ()取消 focus
+ +
+
+ + +

全局函数

+ +
+
+ + UIView () +
+
+ 通过这个方法创建一个UIView对象 + + + +

返回值:

+
    + + UIView + view +
+ + + +

例子:

+
    +
    local view = UIView();
    +
+ +
+
+

实例方法

+ +
+
+ + setFrame (x, y, w, h) +
+
+ 设置View的位置和大小 + + +

参数:

+
    +
  • x + number + x坐标 +
  • +
  • y + number + y坐标 +
  • +
  • w + number + 宽 +
  • +
  • h + number + 高 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setFrame(10,10,100,100);
    + --或者
    + view.frame(10,10,100,100);
    + --或者
    + view.frame(10,10); --如果只是传递两个值宽高保持原值
    +
    +
+ +
+
+ + frame () +
+
+ 获取View的位置和大小 + + + +

返回值:

+
    +
  1. + number + x
  2. +
  3. + number + y
  4. +
  5. + number + w
  6. +
  7. + number + h
  8. +
+ + + +

例子:

+
    +
    local x,y,w,h = view.frame();
    +
+ +
+
+ + setBackgroundColor (color, alpha) +
+
+ 设置View的背景色 + + +

参数:

+
    +
  • color + int + 颜色值 +
  • +
  • alpha + number + 透明度 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setFrame(10,10,100,100);
    + --或者
    + view.frame(10,10,100,100);
    + --或者
    + view.frame(10,10); --如果只是传递两个值宽高保持原值
    +
    +
+ +
+
+ + backgroundColor () +
+
+ 获取View的背景色 + + + +

返回值:

+
    +
  1. + int + color 颜色值(例如0xff0000)
  2. +
  3. + number + alpha 透明度(0~1)
  4. +
+ + + +

例子:

+
    +
    local color, alpha = view.backgroundColor();
    +
+ +
+
+ + setSize (w, h) +
+
+ 设置View的大小 + + +

参数:

+
    +
  • w + number + 宽 +
  • +
  • h + number + 高 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setSize(100,100);
    + --或者
    + view.size(100,100);
    + --或者
    + view.size(100,100);
    +
+ +
+
+ + size () +
+
+ 获取View的大小 + + + +

返回值:

+
    +
  1. + number + w
  2. +
  3. + number + h
  4. +
+ + + +

例子:

+
    +
    local w,h = view.size();
    +
+ +
+
+ + setOrigin (x, y) +
+
+ 设置View的位置 + + +

参数:

+
    +
  • x + number + x坐标 +
  • +
  • y + number + y坐标 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setOrigin(10,10,100,100);
    + --或者
    + view.orgrin(10,10 );
    + --或者
    + view.orgrin(10,10);
    +
+ +
+
+ + orgrin () +
+
+ 获取View的位置 + + + +

返回值:

+
    +
  1. + number + x
  2. +
  3. + number + y
  4. +
+ + + +

例子:

+
    +
    local x,y = view.orgrin();
    +
+ +
+
+ + setCenter (x, y) +
+
+ 设置View的中心点位置 + + +

参数:

+
    +
  • x + number + 中心坐标x +
  • +
  • y + number + 中心坐标y +
  • +
+ + + + +

例子:

+
    +
    local view = UIView();
    + view.setCenter(100,100);
    +
+ +
+
+ + center () +
+
+ 获取View的中心点位置 + + + +

返回值:

+
    +
  1. + x + x中心坐标
  2. +
  3. + y + y中心坐标
  4. +
+ + + +

例子:

+
    +
    local x,y = view.center();
    +
+ +
+
+ + setX (x) +
+
+ 设置View的x坐标 + + +

参数:

+
    +
  • x + number + x坐标 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setX(10);
    + --或者
    + view.x(10);
    + --或者
    + view.x = 10;
    +
+ +
+
+ + x () +
+
+ 获取View的x坐标 + + + +

返回值:

+
    + + number + x +
+ + + +

例子:

+
    +
    local x= view.x();
    +
+ +
+
+ + setY (y) +
+
+ 设置View的y坐标 + + +

参数:

+
    +
  • y + number + y坐标 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setY(10);
    + --或者
    + view.y(10);
    + --或者
    + view.y = 10;
    +
+ +
+
+ + y () +
+
+ 获取View的y坐标 + + + +

返回值:

+
    + + number + y +
+ + + +

例子:

+
    +
    local y = view.y();
    +
+ +
+
+ + setTop (y) +
+
+ 设置View的y坐标 + + +

参数:

+
    +
  • y + number + y坐标 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setTop(10);
    + --或者
    + view.top(10);
    + --或者
    + view.top = 10;
    +
+ +
+
+ + top () +
+
+ 获取View的y坐标 + + + +

返回值:

+
    + + number + y +
+ + + +

例子:

+
    +
    local y = view.top();
    +
+ +
+
+ + setLeft (x) +
+
+ 设置View的x位置 + + +

参数:

+
    +
  • x + number + x坐标 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setLeft(10);
    + --或者
    + view.left(10);
    + --或者
    + view.left = 10;
    +
+ +
+
+ + left () +
+
+ 获取View的x坐标 + + + +

返回值:

+
    + + number + x +
+ + + +

例子:

+
    +
    local x= view.left();
    +
+ +
+
+ + setBottom (bottom) +
+
+ 设置View的bottom坐标 + + +

参数:

+
    +
  • bottom + number + bottom坐标 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setBottom(10);
    + --或者
    + view.bottom(10);
    + --或者
    + view.bottom = 10;
    +
+ +
+
+ + bottom () +
+
+ 获取View的bottom坐标 + + + +

返回值:

+
    + + number + bottom +
+ + + +

例子:

+
    +
    local botom = view.bottom();
    +
+ +
+
+ + setRight (right) +
+
+ 设置View的right位置 + + +

参数:

+
    +
  • right + number + right坐标 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setRight(10);
    + --或者
    + view.right(10);
    + --或者
    + view.right = 10;
    +
+ +
+
+ + rigth () +
+
+ 获取View的right坐标 + + + +

返回值:

+
    + + number + right +
+ + + +

例子:

+
    +
    local right = view.right();
    +
+ +
+
+ + setWidth (w) +
+
+ 设置View的宽 + + +

参数:

+
    +
  • w + number + 宽 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setWidth(100);
    + --或者
    + view.width(100);
    + --或者
    + view.width(100);
    +
+ +
+
+ + width () +
+
+ 获取View的宽 + + + +

返回值:

+
    + + number + w +
+ + + +

例子:

+
    +
    local w = view.width();
    +
+ +
+
+ + setHeight (h) +
+
+ 设置View的高 + + +

参数:

+
    +
  • h + number + 高 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setHeight(100);
    + --或者
    + view.height(100);
    + --或者
    + view.height(100);
    +
+ +
+
+ + height () +
+
+ 获取View的高 + + + +

返回值:

+
    + + number + h +
+ + + +

例子:

+
    +
    local h = view.height();
    +
+ +
+
+ + setCenterX (x) +
+
+ 设置View的中心点x坐标 + + +

参数:

+
    +
  • x + number + 中心坐标x +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setCenterX(100);
    + --或者
    + view.centerX = 100;
    +
+ +
+
+ + centerX () +
+
+ 获取View的中心点x坐标 + + + +

返回值:

+
    + + number + x x中心坐标 +
+ + + +

例子:

+
    +
    local x = view.centerX();
    +
+ +
+
+ + setCenterY (y) +
+
+ 设置View的中心点y坐标 + + +

参数:

+
    +
  • y + number + 中心坐标y +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setCenterY(100);
    + --或者
    + view.centerY = 100;
    +
+ +
+
+ + centerY () +
+
+ 获取View的中心点y坐标 + + + +

返回值:

+
    + + number + y y中心坐标 +
+ + + +

例子:

+
    +
    local y = view.centerX();
    +
+ +
+
+ + setHidden (hidden) +
+
+ 设置可见状态 + + +

参数:

+
    +
  • hidden + bool + true: 隐藏 false:可见 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setHidden(false);
    + --或者
    + view.hidden = false;
    +
+ +
+
+ + hidden () +
+
+ 获取可见状态 + + + +

返回值:

+
    + + bool + 是否隐藏 +
+ + + +

例子:

+
    +
    view.hidden();
    +
+ +
+
+ + setEnabled (enable) +
+
+ 设置View enable控制是否收触摸事件 + + +

参数:

+
    +
  • enable + bool + true/false +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setUserInteractionEnabled(false);
    + --或者
    + view.userInteractionEnabled(false);
    + --或者
    + view.userInteractionEnabled = false;
    +
+ +
+
+ + enabled () +
+
+ 获取View enable状态 + + + +

返回值:

+
    + + bool + true/false +
+ + + +

例子:

+
    +
    local ret = view.userInteractionEnabled();
    +
+ +
+
+ + setAlpha (alpha) +
+
+ 设置alpha值 + + +

参数:

+
    +
  • alpha + number + 透明度(0~1.0) +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setAlpha(0.5);
    + --或者:
    + view.alpha(0.5);
    + --或者:
    + view.alpha = 0.5;
    +
+ +
+
+ + alpha () +
+
+ 获取alpha值 + + + +

返回值:

+
    + + number + alpha值 +
+ + + +

例子:

+
    +
    local alpha = view.alpha();
    +
+ +
+
+ + setCornerRadius (radius) +
+
+ 设置边框圆角半径 + + +

参数:

+
    +
  • radius + number + 半径 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setCornerRadius(8);
    + --或者
    + view.cornerRadius(8);
    + --或者
    + view.cornerRadius = 8;
    +
+ +
+
+ + cornerRadius () +
+
+ 获取边框圆角半径 + + + +

返回值:

+
    + + number + radius 半径 +
+ + + +

例子:

+
    +
    local r = view.cornerRadius();
    + --或者 view.cornerRadius(8);
    +
+ +
+
+ + setBorderWidth (borderWidth) +
+
+ 设置边框粗细 + + +

参数:

+
    +
  • borderWidth + number + + + +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setBorderWidth(3);
    + --或者
    + view.borderWidth(3);
    + --或者
    + view.borderWidth = 3;
    +
+ +
+
+ + borderWidth () +
+
+ 获取边框粗细 + + + +

返回值:

+
    + + number + borderWidth +
+ + + +

例子:

+
    +
    local borderWidth = view.borderWidth();
    +
+ +
+
+ + setBorderColor (color, alpha) +
+
+ 设置边框颜色 + + +

参数:

+
    +
  • color + int + 颜色值 +
  • +
  • alpha + number + 透明度 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setBorderColor(0x0000ff); -- alpha省缺默认是1
    + --或者
    + view.borderColor(0x0000ff,0.5);
    + --或者
    + view.borderColor = 0x0000ff;
    +
+ +
+
+ + borderColor () +
+
+ 获取边框颜色 + + + +

返回值:

+
    +
  1. + int + color 颜色值
  2. +
  3. + number + alpha 透明度
  4. +
+ + + +

例子:

+
    +
    local color,alpha = view.borderColor();
    +
+ +
+
+ + setClipsToBounds (clipsToBounds) +
+
+ 设置View边框是否剪接 + + +

参数:

+
    +
  • clipsToBounds + bool + 是否边框剪切 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setClipsToBounds(true);
    + --或者
    + view.clipsToBounds(true);
    + --或者
    + view.clipsToBounds = true;
    +
+ +
+
+ + clipsToBounds () +
+
+ 获取View边框是否剪接 + + + +

返回值:

+
    + + bool + clipsToBounds 是否边框剪切 +
+ + + +

例子:

+
    +
    local  ret = view.clipsToBounds();
    +
+ +
+
+ + setShadowPath (shadowPath) +
+
+ 设置 只对边框外部加阴影 + + +

参数:

+
    +
  • shadowPath + bool + 只对边框外部加阴影 +
  • +
+ + + + +

例子:

+
    +
    local view = UIView();
    + view.setShadowPath(true);
    +
+ +
+
+ + setMasksToBounds (masksToBounds) +
+
+ 设置边框是否裁剪 + + +

参数:

+
    +
  • masksToBounds + bool + 是否边框剪切 +
  • +
+ + + + +

例子:

+
    +
    local view = UIView();
    + view.setMasksToBounds(true);
    +
+ +
+
+ + setShadowOffset (x, y) +
+
+ 设置View阴影偏移位置 + + +

参数:

+
    +
  • x + number + x偏移 +
  • +
  • y + number + y偏移 +
  • +
+ + + + +

例子:

+
    +
    local view = UIView();
    + view.setShadowOffset(2,2);
    +
+ +
+
+ + setShadowRadius (r) +
+
+ 设置View阴影高斯模糊半径 + + +

参数:

+
    +
  • r + number + 模糊半径 +
  • +
+ + + + +

例子:

+
    +
    local view = UIView();
    + view.setShadowRadius(3);
    +
+ +
+
+ + setShadowOpacity (alpha) +
+
+ 设置View阴影透明度 + + +

参数:

+
    +
  • alpha + number + 透明度 +
  • +
+ + + + +

例子:

+
    +
    local view = UIView();
    + view.setShadowOpacity(0.5);
    +
+ +
+
+ + setShadowColor (color, alpha) +
+
+ 设置View阴影颜色 + + +

参数:

+
    +
  • color + int + 颜色值 +
  • +
  • alpha + number + 透明度 +
  • +
+ + + + +

例子:

+
    +
    local view = UIView();
    + view.setShadowColor(0xff0000, 0.5);
    +
+ +
+
+ + sizeToFit () +
+
+ 适应View内容的大小 + + + + + + +

例子:

+
    +
     local label = UILabel();
    + label.setText("测试");
    + label.sizeToFit();
    +
+ +
+
+ + addGestureRecognizer (gestureRecognizer) +
+
+ 添加手势 + + +

参数:

+
    +
  • gestureRecognizer + UIGestureRecognizer + 手势 +
  • +
+ + + + +

例子:

+
    +
     local g = UISwipeGestureRecognizer(^(gesture){
    +     if( gesture.state()==UIGestureRecognizerStateEnded ) then
    +          print( "两个手势向左滑动" );
    +     end
    + });
    + g.setNumberOfTouchesRequired(2); -- 两个手指才出发
    + g.setDirection(UISwipeGestureRecognizerDirectionLeft); -- 手势方向
    + window.addGestureRecognizer(g);
    +
+ +
+
+ + removeGestureRecognizer (gestureRecognizer) +
+
+ 移除手势 + + +

参数:

+
    +
  • gestureRecognizer + UIGestureRecognizer + 手势 +
  • +
+ + + + +

例子:

+
    +
    view.addGestureRecognizer( gestureRecognizer );
    +
+ +
+
+ + addView (view) +
+
+ 添加子类 + + +

参数:

+ + + + + +

例子:

+
    +
     local view = UIView();
    + local button = UIButton();
    + view.addSubview(button);
    +
+ +
+
+ + removeFromSuper () +
+
+ 从父类中移除自身 + + + + + + +

例子:

+
    +
    button.removeFromSuper();
    +
+ +
+
+ + removeAllViews () +
+
+ 移除所有子类 + + + + + + +

例子:

+
    +
    button.removeAllViews();
    +
+ +
+
+ + setRotation (angle) +
+
+ 设置view 绕Z轴旋转弧度 + + +

参数:

+
    +
  • angle + number + UIView逆时针绕中心点旋转的弧度 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setRotation(3.14);
    + --或者:
    + view.rotation(3.14 );
    + 
    +
+ +
+
+ + rotation (angle) +
+
+ 获取view绕Z轴旋转弧度 + + +

参数:

+
    +
  • angle + number + UIView逆时针绕中心点旋转的弧度 +
  • +
+ + + + + +
+
+ + setRotationX (angle) +
+
+ 设置view 绕X轴旋转弧度 + + +

参数:

+
    +
  • angle + number + UIView逆时针绕中心点旋转的弧度 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setRotationX(3.14);
    + --或者:
    + view.rotationX(3.14 );
    + 
    +
+ +
+
+ + rotationX (angle) +
+
+ 获取view绕X轴旋转弧度 + + +

参数:

+
    +
  • angle + number + UIView逆时针绕中心点旋转的弧度 +
  • +
+ + + + + +
+
+ + setRotationY (angle) +
+
+ 设置view 绕Y轴旋转弧度 + + +

参数:

+
    +
  • angle + number + UIView逆时针绕中心点旋转的弧度 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setRotationY(3.14);
    + --或者:
    + view.rotation(3.14 );
    + 
    +
+ +
+
+ + rotationY (angle) +
+
+ 获取view绕Y轴旋转弧度 + + +

参数:

+
    +
  • angle + number + UIView逆时针绕中心点旋转的弧度 +
  • +
+ + + + + +
+
+ + setScale (scaleX, scaleY) +
+
+ 设置view缩放 + + +

参数:

+
    +
  • scaleX + number + x轴缩放大小 +
  • +
  • scaleY + number + y轴缩放大小 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setScale(0.8, 0.8);
    + --或者:
    + view.scale(0.5 ); -- scaleY默认是1
    + 
    +
+ +
+
+ + scale () +
+
+ 获取view X轴 Y轴 缩放 + + + +

返回值:

+
    +
  1. + number + scaleX x轴缩放大小
  2. +
  3. + number + scaleY y轴缩放大小
  4. +
+ + + + +
+
+ + setScaleX (scaleX) +
+
+ 设置view X轴缩放 + + +

参数:

+
    +
  • scaleX + number + x轴缩放大小 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setScaleX(0.8, 0.8);
    + --或者:
    + view.scaleX(0.5 );
    + 
    +
+ +
+
+ + scaleX () +
+
+ 获取view缩放 + + + +

返回值:

+
    + + number + scaleX x轴缩放大小 +
+ + + + +
+
+ + setScaleY (scaleY) +
+
+ 设置view Y轴缩放 + + +

参数:

+
    +
  • scaleY + number + y轴缩放大小 +
  • +
+ + + + +

例子:

+
    +
     local view = UIView();
    + view.setScaleY(0.8);
    + --或者:
    + view.scaleY(0.5 );
    + 
    +
+ +
+
+ + scaleY () +
+
+ 获取view缩放 + + + +

返回值:

+
    + + number + scaleY y轴缩放大小 +
+ + + + +
+
+ + setTransform3D (transform3D) +
+
+ 设置3D变换矩阵 + + +

参数:

+ + + + + + +
+
+ + setAnchorPoint (x, y) +
+
+ 设置中心点位置 + + +

参数:

+
    +
  • x + number + 数值区间: 0~1 +
  • +
  • y + number + 数值区间: 0~1 +
  • +
+ + + + +

例子:

+
    +
    view.anchorPoint(0.5, 0.5);
    +
+ +
+
+ + anchorPoint () +
+
+ 获取中心点位置 + + + +

返回值:

+
    +
  1. + number + x 数值区间: 0~1
  2. +
  3. + number + y 数值区间: 0~1
  4. +
+ + + + +
+
+ + setDelegate (delegate) +
+
+ 设置delegate + + +

参数:

+
    +
  • delegate + function + 代理方法 +
  • +
+ + + + +

例子:

+
    +
     view.setDelegate( function(){
    +     -- code
    + } );
    +
    + --或者:
    + view.delegate( function(){
    +    -- code
    + } );
    +
    + --或者:
    + view.delegate = function(){
    +     -- code
    + };
    +
+ +
+
+ + isFirstResponder () +
+
+ 是否FirstResponder + + + +

返回值:

+
    + + bool + yes +
+ + + + +
+
+ + becomeFirstResponder () +
+
+ 设置为FirstResponder + + + +

返回值:

+
    + + bool + yes +
+ + + + +
+
+ + resignFirstResponder () +
+
+ 取消FirstResponder + + + +

返回值:

+
    + + bool + yes +
+ + + + +
+
+ + hasFocus () +
+
+ 是否 Focus + + + +

返回值:

+
    + + bool + yes +
+ + + + +
+
+ + requestFocus () +
+
+ focus + + + +

返回值:

+
    + + bool + yes +
+ + + + +
+
+ + cancelFocus () +
+
+ 取消 focus + + + +

返回值:

+
    + + bool + yes +
+ + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/View.html" "b/Doc/API/\347\261\273/View.html" new file mode 100644 index 00000000..8081f453 --- /dev/null +++ "b/Doc/API/\347\261\273/View.html" @@ -0,0 +1,2661 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class View

+

View + 所有UI控件的基类

+

+ +

+ + +

全局函数

+ + + + + +
View ()通过这个方法创建一个View对象
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
frame (x, y, w, h)设置View的位置和大小
frame ()获取View的位置和大小
backgroundColor (color, alpha)设置View的背景色
backgroundColor ()获取View的背景色
size (w, h)设置View的大小
size ()获取View的大小
origin (x, y)设置View的位置
orgrin ()获取View的位置
xy (x, y)设置View的位置
xy ()获取View的位置
center (x, y)设置View的中心点位置
center ()获取View的中心点位置
x (x)设置View的x坐标
x ()获取View的x坐标
y (y)设置View的y坐标
y ()获取View的y坐标
top (y)设置View的y坐标
top ()获取View的y坐标
left (x)设置View的x位置
left ()获取View的x坐标
bottom (bottom)设置View的bottom坐标
bottom ()获取View的bottom坐标
rigth (right)设置View的right位置
rigth ()获取View的right坐标
width (w)设置View的宽
width ()获取View的宽
height (h)设置View的高
height ()获取View的高
centerX (x)设置View的中心点x坐标
centerX ()获取View的中心点x坐标
centerY (y)设置View的中心点y坐标
centerY ()获取View的中心点y坐标
hidden (hidden)设置可见状态
hidden ()获取可见状态
hide ()隐藏 view
isHide ()是否隐藏 view
show ()显示 view
isShow ()是否显示 view
enabled (enable)设置View enable控制是否接收触摸事件
enabled ()获取View enable状态
alpha (alpha)设置alpha值
alpha ()获取alpha值
cornerRadius (radius)设置边框圆角半径
cornerRadius ()获取边框圆角半径
borderWidth (borderWidth)设置边框粗细
borderWidth ()获取边框粗细
borderColor (color, alpha)设置边框颜色
borderColor ()获取边框颜色
shadowPath (shadowPath)设置 只对边框外部加阴影
masksToBounds (masksToBounds)设置边框是否裁剪
shadowOffset (x, y)设置View阴影偏移位置
shadowRadius (r)设置View阴影高斯模糊半径
shadowOpacity (alpha)设置View阴影透明度
shadowColor (color, alpha)设置View阴影颜色
adjustSize ()适应View内容的大小
addGesture (gesture)添加手势
removeGesture (gesture)移除手势
addView (view)添加子类
removeFromSuper ()从父类中移除自身
removeAllViews ()移除所有子类
rotation (angle)设置view 绕Z轴旋转弧度
rotation (angle)获取view绕Z轴旋转弧度
rotationX (angle)设置view 绕X轴旋转弧度
rotationX (angle)获取view绕X轴旋转弧度
rotationY (angle)设置view 绕Y轴旋转弧度
rotationY (angle)获取view绕Y轴旋转弧度
rotationZ (angle)设置view 绕Z轴旋转弧度
rotationZ (angle)获取view绕Z轴旋转弧度
scale (scaleX, scaleY)设置view缩放
scale ()获取view X轴 Y轴 缩放
scaleX (scaleX)设置view X轴缩放
scaleX ()获取view缩放
scaleY (scaleY)设置view Y轴缩放
scaleY ()获取view缩放
transform3D (transform3D)设置3D变换矩阵
anchorPoint (x, y)设置中心点位置
anchorPoint ()获取中心点位置
callback (delegate)设置回调事件处理方法
hasFocus ()是否 Focus
requestFocus ()focus
cancelFocus ()取消 focus
alignLeft ()View水平方向左对齐
alignRight ()View水平方向右对齐
alignTop ()View垂直方向上对齐
alignBottom ()View垂直方向下对齐
align (align, align)设置View对齐方式 + Align.LEFT Align.RIGHT .TOP .BOTTOM .HCENTER .VCENTER
align ()获取View对齐方式 + Align.LEFT Align.RIGHT .TOP .BOTTOM .HCENTER .VCENTER
+ +
+
+ + +

全局函数

+ +
+
+ + View () +
+
+ 通过这个方法创建一个View对象 + + + +

返回值:

+
    + + View + view +
+ + + +

例子:

+
    +
    local view = View();
    +
+ +
+
+

实例方法

+ +
+
+ + frame (x, y, w, h) +
+
+ 设置View的位置和大小 + + +

参数:

+
    +
  • x + number + x坐标 +
  • +
  • y + number + y坐标 +
  • +
  • w + number + 宽 +
  • +
  • h + number + 高 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.frame(10,10,100,100);
    +
+ +
+
+ + frame () +
+
+ 获取View的位置和大小 + + + +

返回值:

+
    +
  1. + number + x
  2. +
  3. + number + y
  4. +
  5. + number + w
  6. +
  7. + number + h
  8. +
+ + + +

例子:

+
    +
    local x,y,w,h = view.frame();
    +
+ +
+
+ + backgroundColor (color, alpha) +
+
+ 设置View的背景色 + + +

参数:

+
    +
  • color + int + 颜色值 +
  • +
  • alpha + number + 透明度 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.backgroundColor(0xff0000 );
    + --或者
    + view.backgroundColor(0xff0000,0.5);
    +
+ +
+
+ + backgroundColor () +
+
+ 获取View的背景色 + + + +

返回值:

+
    +
  1. + int + color 颜色值(例如0xff0000)
  2. +
  3. + number + alpha 透明度(0~1)
  4. +
+ + + +

例子:

+
    +
    local color, alpha = view.backgroundColor();
    +
+ +
+
+ + size (w, h) +
+
+ 设置View的大小 + + +

参数:

+
    +
  • w + number + 宽 +
  • +
  • h + number + 高 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.size(100,100);
    +
+ +
+
+ + size () +
+
+ 获取View的大小 + + + +

返回值:

+
    +
  1. + number + w
  2. +
  3. + number + h
  4. +
+ + + +

例子:

+
    +
    local w,h = view.size();
    +
+ +
+
+ + origin (x, y) +
+
+ 设置View的位置 + + +

参数:

+
    +
  • x + number + x坐标 +
  • +
  • y + number + y坐标 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.origin(10,10);
    +
+ +
+
+ + orgrin () +
+
+ 获取View的位置 + + + +

返回值:

+
    +
  1. + number + x
  2. +
  3. + number + y
  4. +
+ + + +

例子:

+
    +
    local x,y = view.orgrin();
    +
+ +
+
+ + xy (x, y) +
+
+ 设置View的位置 + + +

参数:

+
    +
  • x + number + x坐标 +
  • +
  • y + number + y坐标 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.xy(10,10);
    +
+ +
+
+ + xy () +
+
+ 获取View的位置 + + + +

返回值:

+
    +
  1. + number + x
  2. +
  3. + number + y
  4. +
+ + + +

例子:

+
    +
    local x,y = view.xy();
    +
+ +
+
+ + center (x, y) +
+
+ 设置View的中心点位置 + + +

参数:

+
    +
  • x + number + 中心坐标x +
  • +
  • y + number + 中心坐标y +
  • +
+ + + + +

例子:

+
    +
    local view = View();
    + view.center(100,100);
    +
+ +
+
+ + center () +
+
+ 获取View的中心点位置 + + + +

返回值:

+
    +
  1. + x + x中心坐标
  2. +
  3. + y + y中心坐标
  4. +
+ + + +

例子:

+
    +
    local x,y = view.center();
    +
+ +
+
+ + x (x) +
+
+ 设置View的x坐标 + + +

参数:

+
    +
  • x + number + x坐标 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.x(10);
    +
+ +
+
+ + x () +
+
+ 获取View的x坐标 + + + +

返回值:

+
    + + number + x +
+ + + +

例子:

+
    +
    local x= view.x();
    +
+ +
+
+ + y (y) +
+
+ 设置View的y坐标 + + +

参数:

+
    +
  • y + number + y坐标 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.y(10);
    +
+ +
+
+ + y () +
+
+ 获取View的y坐标 + + + +

返回值:

+
    + + number + y +
+ + + +

例子:

+
    +
    local y = view.y();
    +
+ +
+
+ + top (y) +
+
+ 设置View的y坐标 + + +

参数:

+
    +
  • y + number + y坐标 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.top(10);
    +
+ +
+
+ + top () +
+
+ 获取View的y坐标 + + + +

返回值:

+
    + + number + y +
+ + + +

例子:

+
    +
    local y = view.top();
    +
+ +
+
+ + left (x) +
+
+ 设置View的x位置 + + +

参数:

+
    +
  • x + number + x坐标 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.left(10);
    +
+ +
+
+ + left () +
+
+ 获取View的x坐标 + + + +

返回值:

+
    + + number + x +
+ + + +

例子:

+
    +
    local x= view.left();
    +
+ +
+
+ + bottom (bottom) +
+
+ 设置View的bottom坐标 + + +

参数:

+
    +
  • bottom + number + bottom坐标 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.bottom(10);
    +
+ +
+
+ + bottom () +
+
+ 获取View的bottom坐标 + + + +

返回值:

+
    + + number + bottom +
+ + + +

例子:

+
    +
    local botom = view.bottom();
    +
+ +
+
+ + rigth (right) +
+
+ 设置View的right位置 + + +

参数:

+
    +
  • right + number + right坐标 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.right(10);
    +
+ +
+
+ + rigth () +
+
+ 获取View的right坐标 + + + +

返回值:

+
    + + number + right +
+ + + +

例子:

+
    +
    local right = view.right();
    +
+ +
+
+ + width (w) +
+
+ 设置View的宽 + + +

参数:

+
    +
  • w + number + 宽 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.width(100);
    +
+ +
+
+ + width () +
+
+ 获取View的宽 + + + +

返回值:

+
    + + number + w +
+ + + +

例子:

+
    +
    local w = view.width();
    +
+ +
+
+ + height (h) +
+
+ 设置View的高 + + +

参数:

+
    +
  • h + number + 高 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.height(100);
    +
+ +
+
+ + height () +
+
+ 获取View的高 + + + +

返回值:

+
    + + number + h +
+ + + +

例子:

+
    +
    local h = view.height();
    +
+ +
+
+ + centerX (x) +
+
+ 设置View的中心点x坐标 + + +

参数:

+
    +
  • x + number + 中心坐标x +
  • +
+ + + + +

例子:

+
    +
    local view = View();
    + view.centerX(100);
    +
+ +
+
+ + centerX () +
+
+ 获取View的中心点x坐标 + + + +

返回值:

+
    + + number + x x中心坐标 +
+ + + +

例子:

+
    +
    local x = view.centerX();
    +
+ +
+
+ + centerY (y) +
+
+ 设置View的中心点y坐标 + + +

参数:

+
    +
  • y + number + 中心坐标y +
  • +
+ + + + +

例子:

+
    +
    local view = View();
    + view.centerY(100);
    +
+ +
+
+ + centerY () +
+
+ 获取View的中心点y坐标 + + + +

返回值:

+
    + + number + y y中心坐标 +
+ + + +

例子:

+
    +
    local y = view.centerX();
    +
+ +
+
+ + hidden (hidden) +
+
+ 设置可见状态 + + +

参数:

+
    +
  • hidden + bool + true: 隐藏 false:可见 +
  • +
+ + + + +

例子:

+
    +
    local view = View();
    + view.hidden(false);
    +
+ +
+
+ + hidden () +
+
+ 获取可见状态 + + + +

返回值:

+
    + + bool + 是否隐藏 +
+ + + +

例子:

+
    +
    view.hidden();
    +
+ +
+
+ + hide () +
+
+ 隐藏 view + + + + + + +

例子:

+
    +
    view.hide();
    +
+ +
+
+ + isHide () +
+
+ 是否隐藏 view + + + + + + +

例子:

+
    +
    view.isHide();
    +
+ +
+
+ + show () +
+
+ 显示 view + + + + + + +

例子:

+
    +
    view.hide();
    +
+ +
+
+ + isShow () +
+
+ 是否显示 view + + + + + + +

例子:

+
    +
    view.hide();
    +
+ +
+
+ + enabled (enable) +
+
+ 设置View enable控制是否接收触摸事件 + + +

参数:

+
    +
  • enable + bool + true/false +
  • +
+ + + + +

例子:

+
    +
    local view = View();
    + view.enabled(false);
    +
+ +
+
+ + enabled () +
+
+ 获取View enable状态 + + + +

返回值:

+
    + + bool + true/false +
+ + + +

例子:

+
    +
    local ret = view.userInteractionEnabled();
    +
+ +
+
+ + alpha (alpha) +
+
+ 设置alpha值 + + +

参数:

+
    +
  • alpha + number + 透明度(0~1.0) +
  • +
+ + + + +

例子:

+
    +
    local view = View();
    + view.alpha(0.5);
    +
+ +
+
+ + alpha () +
+
+ 获取alpha值 + + + +

返回值:

+
    + + number + alpha值 +
+ + + +

例子:

+
    +
    local alpha = view.alpha();
    +
+ +
+
+ + cornerRadius (radius) +
+
+ 设置边框圆角半径 + + +

参数:

+
    +
  • radius + number + 半径 +
  • +
+ + + + +

例子:

+
    +
    local view = View();
    + view.cornerRadius(8);
    +
+ +
+
+ + cornerRadius () +
+
+ 获取边框圆角半径 + + + +

返回值:

+
    + + number + radius 半径 +
+ + + +

例子:

+
    +
    local r = view.cornerRadius();
    + --或者 view.cornerRadius(8);
    +
+ +
+
+ + borderWidth (borderWidth) +
+
+ 设置边框粗细 + + +

参数:

+
    +
  • borderWidth + number + + + +
  • +
+ + + + +

例子:

+
    +
    local view = View();
    + view.borderWidth(3);
    +
+ +
+
+ + borderWidth () +
+
+ 获取边框粗细 + + + +

返回值:

+
    + + number + borderWidth +
+ + + +

例子:

+
    +
    local borderWidth = view.borderWidth();
    +
+ +
+
+ + borderColor (color, alpha) +
+
+ 设置边框颜色 + + +

参数:

+
    +
  • color + int + 颜色值 +
  • +
  • alpha + number + 透明度 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.borderColor(0x0000ff); -- alpha省缺默认是1
    + --或者
    + view.borderColor(0x0000ff,0.5);
    +
+ +
+
+ + borderColor () +
+
+ 获取边框颜色 + + + +

返回值:

+
    +
  1. + int + color 颜色值
  2. +
  3. + number + alpha 透明度
  4. +
+ + + +

例子:

+
    +
    local color,alpha = view.borderColor();
    +
+ +
+
+ + shadowPath (shadowPath) +
+
+ 设置 只对边框外部加阴影 + + +

参数:

+
    +
  • shadowPath + bool + 只对边框外部加阴影 +
  • +
+ + + + +

例子:

+
    +
    local view = View();
    + view.shadowPath(true);
    +
+ +
+
+ + masksToBounds (masksToBounds) +
+
+ 设置边框是否裁剪 + + +

参数:

+
    +
  • masksToBounds + bool + 是否边框剪切 +
  • +
+ + + + +

例子:

+
    +
    local view = View();
    + view.masksToBounds(true);
    +
+ +
+
+ + shadowOffset (x, y) +
+
+ 设置View阴影偏移位置 + + +

参数:

+
    +
  • x + number + x偏移 +
  • +
  • y + number + y偏移 +
  • +
+ + + + +

例子:

+
    +
    local view = View();
    + view.shadowOffset(2,2);
    +
+ +
+
+ + shadowRadius (r) +
+
+ 设置View阴影高斯模糊半径 + + +

参数:

+
    +
  • r + number + 模糊半径 +
  • +
+ + + + +

例子:

+
    +
    local view = View();
    + view.shadowRadius(3);
    +
+ +
+
+ + shadowOpacity (alpha) +
+
+ 设置View阴影透明度 + + +

参数:

+
    +
  • alpha + number + 透明度 +
  • +
+ + + + +

例子:

+
    +
    local view = View();
    + view.shadowOpacity(0.5);
    +
+ +
+
+ + shadowColor (color, alpha) +
+
+ 设置View阴影颜色 + + +

参数:

+
    +
  • color + int + 颜色值 +
  • +
  • alpha + number + 透明度 +
  • +
+ + + + +

例子:

+
    +
    local view = View();
    + view.shadowColor(0xff0000, 0.5);
    +
+ +
+
+ + adjustSize () +
+
+ 适应View内容的大小 + + + + + + +

例子:

+
    +
     local label = Label();
    + label.text("测试");
    + label.adjustSize();
    +
+ +
+
+ + addGesture (gesture) +
+
+ 添加手势 + + +

参数:

+
    +
  • gesture + Gesture + 手势 +
  • +
+ + + + +

例子:

+
    +
     local g = SwipeGesture(^(gesture){
    +     if( gesture.state()==GestureState.END ) then
    +          print( "两个手势向左滑动" );
    +     end
    + });
    + g.touchCount(2); -- 两个手指才出发
    + g.direction( GestureDirection.LEFT ); -- 手势方向
    + window.addGesture(g);
    +
+ +
+
+ + removeGesture (gesture) +
+
+ 移除手势 + + +

参数:

+
    +
  • gesture + Gesture + 手势 +
  • +
+ + + + +

例子:

+
    +
    view.addGesture( gesture );
    +
+ +
+
+ + addView (view) +
+
+ 添加子类 + + +

参数:

+
    +
  • view + View + view +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + local button = Button();
    + view.addSubview(button);
    +
+ +
+
+ + removeFromSuper () +
+
+ 从父类中移除自身 + + + + + + +

例子:

+
    +
    button.removeFromSuper();
    +
+ +
+
+ + removeAllViews () +
+
+ 移除所有子类 + + + + + + +

例子:

+
    +
    button.removeAllViews();
    +
+ +
+
+ + rotation (angle) +
+
+ 设置view 绕Z轴旋转弧度 + + +

参数:

+
    +
  • angle + number + View逆时针绕中心点旋转的弧度 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.rotation(3.14);
    + 
    +
+ +
+
+ + rotation (angle) +
+
+ 获取view绕Z轴旋转弧度 + + +

参数:

+
    +
  • angle + number + View逆时针绕中心点旋转的弧度 +
  • +
+ + + + + +
+
+ + rotationX (angle) +
+
+ 设置view 绕X轴旋转弧度 + + +

参数:

+
    +
  • angle + number + View逆时针绕中心点旋转的弧度 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.rotationX(3.14 );
    + 
    +
+ +
+
+ + rotationX (angle) +
+
+ 获取view绕X轴旋转弧度 + + +

参数:

+
    +
  • angle + number + View逆时针绕中心点旋转的弧度 +
  • +
+ + + + + +
+
+ + rotationY (angle) +
+
+ 设置view 绕Y轴旋转弧度 + + +

参数:

+
    +
  • angle + number + View逆时针绕中心点旋转的弧度 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.rotationY(3.14 );
    + 
    +
+ +
+
+ + rotationY (angle) +
+
+ 获取view绕Y轴旋转弧度 + + +

参数:

+
    +
  • angle + number + View逆时针绕中心点旋转的弧度 +
  • +
+ + + + + +
+
+ + rotationZ (angle) +
+
+ 设置view 绕Z轴旋转弧度 + + +

参数:

+
    +
  • angle + number + View逆时针绕中心点旋转的弧度 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.rotationY(3.14 );
    + 
    +
+ +
+
+ + rotationZ (angle) +
+
+ 获取view绕Z轴旋转弧度 + + +

参数:

+
    +
  • angle + number + View逆时针绕中心点旋转的弧度 +
  • +
+ + + + + +
+
+ + scale (scaleX, scaleY) +
+
+ 设置view缩放 + + +

参数:

+
    +
  • scaleX + number + x轴缩放大小 +
  • +
  • scaleY + number + y轴缩放大小 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.scale(0.8, 0.8);
    + 
    +
+ +
+
+ + scale () +
+
+ 获取view X轴 Y轴 缩放 + + + +

返回值:

+
    +
  1. + number + scaleX x轴缩放大小
  2. +
  3. + number + scaleY y轴缩放大小
  4. +
+ + + + +
+
+ + scaleX (scaleX) +
+
+ 设置view X轴缩放 + + +

参数:

+
    +
  • scaleX + number + x轴缩放大小 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.scaleX(0.8);
    + 
    +
+ +
+
+ + scaleX () +
+
+ 获取view缩放 + + + +

返回值:

+
    + + number + scaleX x轴缩放大小 +
+ + + + +
+
+ + scaleY (scaleY) +
+
+ 设置view Y轴缩放 + + +

参数:

+
    +
  • scaleY + number + y轴缩放大小 +
  • +
+ + + + +

例子:

+
    +
     local view = View();
    + view.scaleY(0.8);
    + 
    +
+ +
+
+ + scaleY () +
+
+ 获取view缩放 + + + +

返回值:

+
    + + number + scaleY y轴缩放大小 +
+ + + + +
+
+ + transform3D (transform3D) +
+
+ 设置3D变换矩阵 + + +

参数:

+ + + + + + +
+
+ + anchorPoint (x, y) +
+
+ 设置中心点位置 + + +

参数:

+
    +
  • x + number + 数值区间: 0~1 +
  • +
  • y + number + 数值区间: 0~1 +
  • +
+ + + + +

例子:

+
    +
    view.anchorPoint(0.5, 0.5);
    +
+ +
+
+ + anchorPoint () +
+
+ 获取中心点位置 + + + +

返回值:

+
    +
  1. + number + x 数值区间: 0~1
  2. +
  3. + number + y 数值区间: 0~1
  4. +
+ + + + +
+
+ + callback (delegate) +
+
+ 设置回调事件处理方法 + + +

参数:

+
    +
  • delegate + function + 代理方法 +
  • +
+ + + + +

例子:

+
    +
     view.callback( function()
    +     -- code
    + end );
    +
+ +
+
+ + hasFocus () +
+
+ 是否 Focus + + + +

返回值:

+
    + + bool + yes +
+ + + + +
+
+ + requestFocus () +
+
+ focus + + + +

返回值:

+
    + + bool + yes +
+ + + + +
+
+ + cancelFocus () +
+
+ 取消 focus + + + +

返回值:

+
    + + bool + yes +
+ + + + +
+
+ + alignLeft () +
+
+ View水平方向左对齐 + + + + + + + +
+
+ + alignRight () +
+
+ View水平方向右对齐 + + + + + + + +
+
+ + alignTop () +
+
+ View垂直方向上对齐 + + + + + + + +
+
+ + alignBottom () +
+
+ View垂直方向下对齐 + + + + + + + +
+
+ + align (align, align) +
+
+ 设置View对齐方式 + Align.LEFT Align.RIGHT .TOP .BOTTOM .HCENTER .VCENTER + + +

参数:

+
    +
  • align + Align + 垂直对齐方式 +
  • +
  • align + Align + 垂直对齐方式 +
  • +
+ + + + +

例子:

+
    +
    view.anchorPoint(Align.LEFT,Align.V_CENTER);
    +
+ +
+
+ + align () +
+
+ 获取View对齐方式 + Align.LEFT Align.RIGHT .TOP .BOTTOM .HCENTER .VCENTER + + + + + + +

例子:

+
    +
    view.anchorPoint();
    +
+ +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git "a/Doc/API/\347\261\273/string.html" "b/Doc/API/\347\261\273/string.html" new file mode 100644 index 00000000..651e0f87 --- /dev/null +++ "b/Doc/API/\347\261\273/string.html" @@ -0,0 +1,628 @@ + + + + + LuaView SDK + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + + +
+ +

Class string

+

字符串处理库

+

+ +

+ + +

全局函数

+ + + + + + + + + + + + + +
string:char ()字符拼接
string:dump (function)函数 string:dump 返回一个函数二进制形式的字符串 + 函数 string:dump 实现了函数的序列化,函数可以很轻松的传递, + 并在其他作用域调用。函数 string:dump 出来的二进制字符串,可以用 load 函数反序列回来直接调用。
string:format ()用于把字符串格式化输出 + 函数的第一个参数是用来指定字符串的格式
+

实例方法

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
byte (i, j)字符串第几个到第几个 字符值
find (pattern)查找字符串 s 里第一个符合查找字符 pattern 的位置 + 如果找到了目标字符 pattern,则返回它的开始和结束位置
gfind ()会返回一个迭代函数,可通过该函数遍历到一个字符串 s 中所有出现指定匹配模式 pattern 的地方
gmatch ()gmatch 会返回一个迭代函数,可通过该函数遍历到一个字符串 s 中所有出现指定匹配模式 pattern 的地方
gsub (pattern, repl, n)用于全局字符串替换,字符串 s 里满足匹配模式 pattern 格式的字符都会被替换成 repl 参数的值
len ()用于返回字符串 s 的长度
lower ()用于把字符串 s 里的字母转为小写
match (pattern)用于查找字符串 s 里第一个匹配对模式 pattern 的值,并返回匹配值
rep (n, sep)生成一个由分隔符 sep 隔开的重复(repeat)n 次字符 s 的字符串
reverse ()用于倒转一个字符串 s 的排序
sub (i, j)用于从字符串 s 里截取一个从第 i 个字符到第 j 个字符间的子字符串
upper ()用于把字符串 s 里的字母转为大写
+ +
+
+ + +

全局函数

+ +
+
+ + string:char () +
+
+ 字符拼接 + + + + + + +

例子:

+
    +
    + print( string:char(51,52,53) ) -- 输出: 345
    +
    +
+ +
+
+ + string:dump (function) +
+
+ 函数 string:dump 返回一个函数二进制形式的字符串 + 函数 string:dump 实现了函数的序列化,函数可以很轻松的传递, + 并在其他作用域调用。函数 string:dump 出来的二进制字符串,可以用 load 函数反序列回来直接调用。 + + +

参数:

+
    +
  • function + function + 函数 +
  • +
+ + + + +

例子:

+
    +
    + function test()
    +     print("just a test")
    + end
    + print(string:dump(test))
    +
+ +
+
+ + string:format () +
+
+ 用于把字符串格式化输出 + 函数的第一个参数是用来指定字符串的格式 + + + + + + +

例子:

+
    +
  • print(string:format("%s is %d", "ten", 10))
  • +
  • + .           所有字符
    + %a          字母
    + %c          控制符
    + %d          数字
    + %D          非数字
    + %l          小写字母
    + %p          标点符号
    + %s          字符串
    + %u          大写字母
    + %w          字母数字
    + %x          十六进制数
    + %z          用 0 表示的字符
  • +
+ +
+
+

实例方法

+ +
+
+ + byte (i, j) +
+
+ 字符串第几个到第几个 字符值 + + +

参数:

+
    +
  • i + int + 起始位置 (可选参数) +
  • +
  • j + int + 终点位置 (可选参数) +
  • +
+ + + + +

例子:

+
    +
    + local t = "123456789";
    + print( t.byte(2,4) ) -- 输出: 50	51	52
    +
    +
+ +
+
+ + find (pattern) +
+
+ 查找字符串 s 里第一个符合查找字符 pattern 的位置 + 如果找到了目标字符 pattern,则返回它的开始和结束位置 + + +

参数:

+
    +
  • pattern + string + 查找字符串 +
  • +
+ +

返回值:

+
    +
  1. + start + + +
  2. +
  3. + end + + +
  4. +
+ + + +

例子:

+
    +
    + local s = "just a test";
    + startPos, endPos = s.find("st")
    + print(startPos, endPos)
    +
+ +
+
+ + gfind () +
+
+ 会返回一个迭代函数,可通过该函数遍历到一个字符串 s 中所有出现指定匹配模式 pattern 的地方 + + + + + + +

例子:

+
    +
    + HELP_MESSAGE = [[
    + This is the first line of help to show.
    + And here is the second.
    + And here is the third.
    + Let's make sure to include enough text to bore the user.
    + ]];
    + for line in HELP_MESSAGE.gfind('[^\n]+') do
    +    print(line);
    + end
    +
+ +
+
+ + gmatch () +
+
+ gmatch 会返回一个迭代函数,可通过该函数遍历到一个字符串 s 中所有出现指定匹配模式 pattern 的地方 + + + + + + +

例子:

+
    +
    + s = "just a test"
    + for w in s.gmatch("%a+") do
    + 	   print(w)
    + end
    +
+ +
+
+ + gsub (pattern, repl, n) +
+
+ 用于全局字符串替换,字符串 s 里满足匹配模式 pattern 格式的字符都会被替换成 repl 参数的值 + + +

参数:

+
    +
  • pattern + string + 匹配模式 +
  • +
  • repl + string + 替换结果 +
  • +
  • n + int + 替换次数 (可选参数) +
  • +
+ + + + +

例子:

+
    +
  • + local s = "just a test";
    + print( s.gsub("st", "*"))
    + -- 输出: ju* a te*	2
    +
  • +
  • + local s = "num is 1234567890"
    + print( s.gsub("%d", "*"))
    + --  输出: num is **********	10
    +
  • +
  • + s = "sethook, setlocal, setmetatable, setupvalue, setuservalue"
    + print( s.gsub("s%a+", "S", 2) )
    + --  输出: S, S, setmetatable, setupvalue, setuservalue	2
    +
  • +
+ +
+
+ + len () +
+
+ 用于返回字符串 s 的长度 + + + + + + +

例子:

+
    +
    + local s = "123";
    + print( s.len() )
    +
+ +
+
+ + lower () +
+
+ 用于把字符串 s 里的字母转为小写 + + + + + + +

例子:

+
    +
    + local s = "ABC";
    + print( s.lower() )
    +
+ +
+
+ + match (pattern) +
+
+ 用于查找字符串 s 里第一个匹配对模式 pattern 的值,并返回匹配值 + + +

参数:

+
    +
  • pattern + string + 匹配模式(可以是正则表达式) +
  • +
+ + + + +

例子:

+
    +
  • + local s = "just a test"
    + print(s.match("test"))
  • +
  • + s = "today is 2003-5-31"
    + print(s.match("%d+-%d+-%d+"))
  • +
  • + s = "abcdabcd"
    + print(s.match("a"))
  • +
+ +
+
+ + rep (n, sep) +
+
+ 生成一个由分隔符 sep 隔开的重复(repeat)n 次字符 s 的字符串 + + +

参数:

+
    +
  • n + int + 重复次数 +
  • +
  • sep + string + + + +
  • +
+ + + + +

例子:

+
    +
    + print(string:rep("你好", 3))
    + --输出: 你好你好你好
    +
    +
+ +
+
+ + reverse () +
+
+ 用于倒转一个字符串 s 的排序 + + + + + + +

例子:

+
    +
    + local s = "reverse";
    + print(s.reverse())
    + -- 输出: esrever
    +
    +
+ +
+
+ + sub (i, j) +
+
+ 用于从字符串 s 里截取一个从第 i 个字符到第 j 个字符间的子字符串 + + +

参数:

+
    +
  • i + int + 起始字符index +
  • +
  • j + int + 结束字符index +
  • +
+ +

返回值:

+
    + + string + 子字符串 +
+ + + +

例子:

+
    +
    + local s = "abcdefg";
    + print(s.sub(2, 4))
    +
+ +
+
+ + upper () +
+
+ 用于把字符串 s 里的字母转为大写 + + + + + + + +
+
+ + +
+
+
+Copyright © 2010-2015 Juhuasuan.com 版权所有 +返回顶部 +
+
+ + diff --git a/IOS/Demo/lua/demoH2_CollectionView.lua b/IOS/Demo/lua/demoH2_CollectionView.lua index 6d4c9542..d6857a17 100644 --- a/IOS/Demo/lua/demoH2_CollectionView.lua +++ b/IOS/Demo/lua/demoH2_CollectionView.lua @@ -105,6 +105,7 @@ collectionView = RefreshCollectionView { print(section, row); collectionView.stopRefreshing(); System.gc(); + collectionView.scrollToCell(section, row); end } }, diff --git a/IOS/LuaViewSDK/Classes/lvsdk/LVCollectionView.m b/IOS/LuaViewSDK/Classes/lvsdk/LVCollectionView.m index 8eabb4dd..b404717c 100644 --- a/IOS/LuaViewSDK/Classes/lvsdk/LVCollectionView.m +++ b/IOS/LuaViewSDK/Classes/lvsdk/LVCollectionView.m @@ -201,12 +201,28 @@ static int scrollToCell (lv_State *L) { } } - NSIndexPath* indexPath = [NSIndexPath indexPathForRow:row-1 inSection:section-1]; - UICollectionViewLayoutAttributes* att = [collectionView layoutAttributesForItemAtIndexPath:indexPath]; - CGRect r = [att frame]; - if( att && r.size.height>0 ) { - CGFloat y = r.origin.y + offsetY; - [collectionView setContentOffset:CGPointMake(0, y) animated:animation]; + int nativeSection = section-1; + int nativeRow = row-1 ; + if( 0<=nativeSection && nativeSection0 ) { + CGFloat y = r.origin.y + offsetY; + CGSize contentSize = collectionView.contentSize; + CGRect bounds = collectionView.bounds; + // 越界检查 + if( y + bounds.size.height > contentSize.height ) { + y = contentSize.height - bounds.size.height; + } + if( y < 0 ) { + y = 0; + } + [collectionView setContentOffset:CGPointMake(0, y) animated:animation]; + } } return 0; }