首先两个方法都是异步执行。layoutSubviews方便数据计算,drawRect方便视图重绘。
layoutSubviews在以下情况下会被调用:
1、init初始化不会触发layoutSubviews。
2、addSubview会触发layoutSubviews。
3、设置view的Frame会触发layoutSubviews,当然前提是frame的值设置前后发生了变化。
4、滚动...
分类:
其他好文 时间:
2014-05-13 08:39:56
阅读次数:
246
效果图:
程序分析:
初始化GameLayer场景触摸,背景、音乐、UI及定时间器
bool GameLayer::init()
{
if (!CCLayer::init()) {
return false;
}
// 开启触摸
this->setTouchEnabled(true);
// 创建数组,需要...
分类:
其他好文 时间:
2014-05-13 07:39:29
阅读次数:
214
JavaScript实现弹窗报错
1、具体错误如下
SCRIPT 5022:cannot call methods on dialog prior to initialization;
attempted to call method 'open'.
2、错误原因
3、解决办法...
分类:
编程语言 时间:
2014-05-13 07:01:27
阅读次数:
463
ThisisourongoingLinuxcommandserieswherewearegoingtoreviewhowwecanusechkconfigcommandefficientlywithit’savailableparameters.TheChkconfigcommandtoolallowstoconfigureservicesstartandstopautomaticallyinthe/etc/rd.d/init.dscriptsthroughcommandline.Let’sseesome..
分类:
系统相关 时间:
2014-05-13 04:26:32
阅读次数:
469
Fromtimetotime,peoplewantmetocreateLINUXinitscriptsforthem.Iusuallyjusttakeanexistingoneforanotherserviceandchangeituptoworkformynewapplication,butmostofthemhavebecomesolongthesedaysthatIenduphavingtohackoutatonofcodejusttoreducethemdowntotheverybasicscript..
分类:
系统相关 时间:
2014-05-13 03:59:53
阅读次数:
306
在安装完ambari-server并配置之后,选定客户端进行指定安装的时候,发现总是遇到这一错误AmbariAgenthostcannotreachAmbariServer‘localhost:8080‘.
我看了一下错误日志发现在从ambari-server传送到客户端的setupAgent.py脚本的main函数中的参数设置老是不对,如下所示:156d..
分类:
其他好文 时间:
2014-05-13 00:58:06
阅读次数:
598
想做下面一个效果:想当鼠标移动到按钮上的时候,按钮就变大,图标换个大的,鼠标不在按钮上的时候,按钮就变小,图标也换成小的,感觉比较Cool
实现原理:为每个按钮设置监听属性
void MainHomeForm::init()
{
//为按钮注册事件
ui->SystemSetButton->installEventFilter(this);
ui->ZoneSe...
分类:
移动开发 时间:
2014-05-12 22:57:49
阅读次数:
555
//实例化一个NSDateFormatter对象NSDateFormatter
*dateFormatter = [[NSDateFormatter
alloc]init];//设定时间格式,这里可以设置成自己需要的格式[dateFormatter setDateFormatter:@"yyyy-M...
分类:
其他好文 时间:
2014-05-12 20:30:13
阅读次数:
306
--Linux操作系统位数查看----------------------2014/05/11查看linux是多少位的几位方法:查看linux机器是32位还是64位的方法:方法一:file
/sbin/init 或者 file /bin/ls结果如下:/sbin/init: ELF 64-bit L...
分类:
系统相关 时间:
2014-05-12 20:03:41
阅读次数:
504
ID为0的进程通常是调度进程,常被称为交换进程(swapper),是内核中的系统进程。
ID为1的进程叫做init进程,是一个普通用户进程,不属于内核,由内核调用。
一个现有进程可以调用fork函数创建一个新进程(子进程)。fork函数被调用一次,返回两次。子进程返回值为0,父进程返回值为子进程的进程ID。
当fork出一个子进程后,子进程便拥有独立的数据段、堆、栈的副本,但...
分类:
其他好文 时间:
2014-05-11 22:03:19
阅读次数:
251