您的位置:首页 > 移动开发 > IOS开发

ios开发基础知识 - 2

2011-01-13 09:58 477 查看
移动物体


参考:

Field Key Path Description
rotation.x The rotation, in radians, in the x axis.
rotation.y The rotation, in radians, in the y axis.
rotation.z The rotation, in radians, in the z axis.
rotation The rotation, in radians, in the z axis. This is identical to setting the rotation.z field.
scale.x Scale factor for the x axis.
scale.y Scale factor for the y axis.
scale.z Scale factor for the z axis.
scale Average of all three scale factors.
translation.x Translate in the x axis.
translation.y Translate in the y axis.
translation.z Translate in the z axis.
translation Translate in the x and y axis. Value is an NSSize or CGSize.
访问别的类的属性或者方法
myAppDelegate *appDelegate
= (myAppDelegate *)[[UIApplication sharedApplication] delegate];
[[[appDelegate rootViewController] flipsideViewController] myMethod];


遍历子视图

) {
if (anImage.tag == 1) {
// do something
}
}


播放音乐

[code] // 设置音乐文件路径
path = [[NSBundle mainBundle] pathForResource:@"mani" ofType:@"mp3"]]
[_cloud02 setFrame:CGRectMake(-1024+rand()%600, -768+rand()%300, 2048, 1536)];
[_cloud01 setFrame:CGRectMake(-1024+rand()%600, -768+rand()%300, 2048, 1536)];


Timer

每秒调用

]
[NSTimer scheduledTimerWithTimeInterval:1     target:self
selector:@selector(myMethod)
userInfo:myObject
repeats:YES];


 myObjectMethod]]
[myTimer invalidate];
myTimer = nil;


时间

CFAbsoluteTime myCurrentTime = CFAbsoluteTimeGetCurrent();
[/code]

在模拟器里测试 App 的加速度感应功能

在模拟器里可以用鼠标点击模拟 iPhone 的触摸操作,但重力感应(比如用户倾斜机身来操控飞机/赛车)怎么模拟?按住 command 再按左右方向键,就能在电脑模拟器上测试加速度感应了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: