//程序延迟、闪退、UITextField退出编辑
#import "ViewController.h"
@interface ViewController ()
@property (nonatomic, strong) UITextField *tf;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.tf = [[UITextField alloc] initWithFrame:CGRectMake(80, 100, 200, 40)];
self.tf.backgroundColor = [UIColor yellowColor];
self.tf.layer.cornerRadius = 5;
[self.view addSubview:
self.tf];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
//程序延迟
[NSThread sleepForTimeInterval:1];
//退出编辑
[self.tf endEditing:YES];
//程序闪退
exit(0);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end