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

我的第一个iOS游戏——会写字的喵喵喵

2014-06-04 14:19 99 查看
刚刚学习iOS开发,其实算是个非常弱智的小程序吧,加了点图片。自己觉得还挺好玩的,编程的乐趣嘛,就是这样。自己鼓励自己一下!

程序只有两个自己添加的方法,一个是设置输入信息,用来显示;一个是用来隐藏键盘的。两个输出变量分别是输出标签和输入文本框。

部分代码如下:

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController

@property (weak, nonatomic) IBOutlet UILabel *userOutput;
@property (weak, nonatomic) IBOutlet UITextField *userInput;

- (IBAction)setOutput:(id)sender;
- (IBAction)hideKeyboard:(id)sender;

@end
#import "ViewController.h"

@implementation ViewController

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

- (IBAction)setOutput:(id)sender {
self.userOutput.text = self.userInput.text;
}

- (IBAction)hideKeyboard:(id)sender {
[self.userInput resignFirstResponder];
}

@end
程序图标:



启动界面:



启动后进入初始状态:



输入文字后,点击临摹键,输出标签会编程输入的文字:



哈哈,挺搞笑。希望下一个程序能正经点。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: