// // ViewController.m // test // // Created by myhaspl on 16/12/6. // Copyright (c) 2016年 myhaspl@myhaspl.com. All rights reserved. // #import "ViewController.h" @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // D/Users/liuxing/Documents/pro/test/test/ViewController.mo any additional setup after loading the view, typically from a nib. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (IBAction)langselect:(UIButton *)sender { nowlang=nowlang ^ 1 ; if (nowlang==1){ NSString *myTitle=@"OK"; [_langbtn setTitle:myTitle forState:UIControlStateNormal]; self.mylabel.text=@"hello world"; } else{ NSString *myTitle=@"确定"; [_langbtn setTitle:myTitle forState:UIControlStateNormal]; self.mylabel.text=@"你好,世界"; } } @end
// // ViewController.h // test // // Created by myhaspl on 16/12/6. // Copyright (c) 2016年 myhaspl@myhaspl.com. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController { int nowlang; } @property (weak, nonatomic) IBOutlet UIButton *langbtn; @property (weak, nonatomic) IBOutlet UILabel *mylabel; - (IBAction)langselect:(UIButton *)sender; @end