ios开发基础知识 - 2
2011-01-13 09:58
477 查看
移动物体
访问别的类的属性或者方法
遍历子视图
播放音乐
[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
每秒调用
时间
CFAbsoluteTime myCurrentTime = CFAbsoluteTimeGetCurrent();
[/code]
在模拟器里测试 App 的加速度感应功能
在模拟器里可以用鼠标点击模拟 iPhone 的触摸操作,但重力感应(比如用户倾斜机身来操控飞机/赛车)怎么模拟?按住 command 再按左右方向键,就能在电脑模拟器上测试加速度感应了。
参考:
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 再按左右方向键,就能在电脑模拟器上测试加速度感应了。
相关文章推荐
- iOS开发多线程篇—基础知识 NSOperation
- ios开发基础知识
- iOS开发基础知识:Core Animation(核心动画)
- iOS开发基础知识--碎片42
- IOS开发基础知识--碎片46
- iOS应用开发基础(二)基础知识
- iOS蓝牙开发(一)蓝牙相关基础知识
- iOS开发基础知识--碎片7
- iOS开发基础知识--碎片13
- iOS开发基础知识:Core Animation(核心动画)
- ios开发 UI基础入门知识
- IOS开发之路--C语言基础知识
- iOS开发基础知识--碎片43
- IOS开发基础知识--碎片20
- IOS开发基础知识碎片-导航
- iOS蓝牙开发(一)蓝牙相关基础知识
- IOS开发基础知识--碎片7
- iOS蓝牙开发(一)蓝牙相关基础知识
- iOS蓝牙开发(一)蓝牙相关基础知识
- iOS开发基础知识:Core Animation(核心动画)