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

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/bht890811/article/details/28419063

    刚刚学习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
    程序图标:

    启动界面:

    启动后进入初始状态:

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

    哈哈,挺搞笑。希望下一个程序能正经点。

猜你喜欢

转载自blog.csdn.net/bht890811/article/details/28419063
今日推荐