This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 定义一个UIActionSheet | |
UIActionSheet *actionSheet = [[UIActionSheet alloc] | |
initWithTitle:@"Are you sure?" | |
delegate:self | |
cancelButtonTitle:@"No Way!" | |
destructiveButtonTitle:@"Yes, I'm Sure" | |
// 其他按钮,没有直接写nil | |
otherButtonTitles:@"Foo",@"Bar",nil]; | |
// 放到View中显示 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SomeCell * cell = [tableView dequeueReusableCellWithIdentifier:@"someIdentifier"]; | |
if(cell == nil){ | |
cell = [[SomeCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"someIdentifier"]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(NSString *)md5:(NSString *)str { | |
//转换成utf-8 | |
const char *cStr = [str UTF8String]; | |
//开辟一个16字节(128位:md5加密出来就是128位/bit)的空间(一个字节=8字位=8个二进制数) | |
unsigned char result[16]; | |
CC_MD5( cStr, strlen(cStr), result); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//DataSource.prototype.discoverSchemas | |
//async.parallel(tasks, function (err, results) { | |
// console.log(results); | |
//https://github.com/strongloop/loopback-datasource-juggler/blob/master/lib/datasource.js#L1205 | |
[ | |
[ | |
{ owner: 'chosendb', | |
tableName: 'chosentable', | |
columnName: 'id' | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* [parseURI 解析URI的内容,返回键值对的对象] | |
* @param {[string]} uri [要解析的URI值] | |
* @return {[obj]} [URI的键值对的对象] | |
* @author 水中月明(shuizhongyueming@gmail.com) | |
*/ | |
function parseURI(uri){ | |
var uri = uri || window.location.search; // 默认使用当前页面的uri值 | |
try{ | |
uri = uri.replace("?",""); // 去除? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* [SlideMarkMark 滑动评分组件,目前仅支持横向] | |
* @require jQuery 1.7+ | |
* @demo http://news.7k7k.com/webgame/astd/ | |
* @param {[Object]} slideRegion [将参数打包成对象传入] | |
* @param {[Number]} slideRegion.maxMark [评分的最大值 默认:10] | |
* @param {[Number]} slideRegion.decimalPlace [小数的位数 默认:1] | |
* @param {[Number]} slideRegion.contWidth [滑动区域的宽度 默认:slideRegion.cont.width()] | |
* @param {[Number]} slideRegion.shortestLeft [滑块最小偏移值,考虑到滑块的宽度 一般会认为滑动的按钮的中线(非左右两边)到达两端时为滑动的极限 有默认值] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @name[CloudTag] | |
* @overview [一个UI组件,用于制作云标签, | |
* 依赖jQuery 做的很简单,只能简单的从下往上滚动,没有做到那种球状的旋转] | |
* @param {[Array]} arr [存放云标签内容的数组] | |
* @param {[Array]} fontSizeArr [存放文本大小可以随机的值] | |
* @param {[Array]} colorArr [存放文本颜色可以随机的值] | |
* @param {[Object]} option [传入相关参数] | |
* @param {[string]} option.cont [存放云标签的容器 query string] | |
* @param {[string]} option.tagConts [单个标签的各自的直接父元素 query string] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* @name [getElementsByClassName] | |
* @overview [根据元素clsssName得到元素集合] | |
* @param {[string]} fatherId [父元素的ID,默认为document] | |
* @param {[string]} tagName [子元素的标签名] | |
* @param {[string]} className [用空格分开的className字符串] | |
* | |
* @author unknown | |
*/ | |
function getElementsByClassName(fatherId,tagName,className){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @name [getRealStyle] | |
* @overview [获取元素的CSS属性值] | |
* @param {[Object]} obj [要获取CSS属性值的DOM对象或者jQuery对象] | |
* @param {[string]} styleName [属性名] | |
* @return {[string]} [属性值] | |
* @author unknown | |
*/ | |
function getRealStyle(obj,styleName){//访问CSS属性 | |
var realStyle = null; |
OlderNewer