24点小游戏ios开发(一)
来源:互联网 发布:武汉硅谷软件学院 编辑:程序博客网 时间:2024/06/05 16:52
cocoa社区有很多iOS的小游戏源码(没有24点的大概是因为它落后了...?),我下载了很多来作为参考。游戏源码已传至github:https://github.com/DF-L/24
先是最终的界面:
先是一个计时器的代码,参考了一个touchme的源码。实现按下开始按钮之后开始计时的功能,并记录每次的计时到总时间
.h文件中:NSTimer *timer;
-(void)subtracTime;.m文件中:timer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(subtracTime) userInfo:nil repeats:YES];//计时器-(void)subtracTime{//计时器 if(count!=0){ second+=1; lable18++; } timerLabel.text = [NSString stringWithFormat:@"Time:%d",second]; if(second == 30) { [timer invalidate]; UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Times Out" message:[NSString stringWithFormat:@"Score:%d",score] preferredStyle:UIAlertControllerStyleAlert]; scoreLabel.text = [NSString stringWithFormat:@"Score:%d",score]; UIAlertAction *againAction = [UIAlertAction actionWithTitle:@"Again" style:UIAlertActionStyleCancel handler:nil]; [alert addAction:againAction]; [self presentViewController:alert animated:YES completion:nil]; [self setGame]; }}timerLabel.text = [NSString stringWithFormat:@"倒计时:%d",second];lable10.text =[NSString stringWithFormat:@"总时间:%d",lable18];
阅读全文
0 0
- 24点小游戏ios开发(一)
- 24点小游戏iOS开发(二)--fmdb数据库相关
- iOS swift 2048小游戏开发教程(一)
- IOS学习之路五(SpriteKit 开发飞机大战小游戏一)
- 24点小游戏(c语言)
- 24点小游戏
- 速算24点小游戏
- 24点小游戏
- 24点小游戏算法
- 算24点小游戏
- 24点小游戏
- iOS和Android开发异同点(一)
- 一个24点的小游戏~
- 24点休闲益智小游戏
- js版算24点小游戏
- 【Android小游戏】安卓小游戏开发(直播手把手教学系列一)
- unity3d开发 打飞机小游戏(一)(场景布置)
- 从无到有的Java小游戏开发练习(一)---推箱子
- GIC相关寄存器
- CSS将边框border设定到宽度和高度中
- stm32 CAN过滤器组
- Android组件化开发实践
- Go并发concurrency
- 24点小游戏ios开发(一)
- 使用Spring StateMachine框架实现状态机
- JAVA中String字符串特殊字符的分割问题
- 开源项目Trip: 给Requests加上协程
- linux 2.4内核下自定义USB设备驱动编写
- ecplise中无意删除了Source Folder文件包报错怎么办?
- 【noip2012】引水入城
- javaweb-js错误Cannot return from outside a function or method
- VS Code+Anaconda打造舒适的Python环境