XIB 拖控件

Posted vector11248

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了XIB 拖控件相关的知识,希望对你有一定的参考价值。

按住ctrl键就开始拖

 1 //
 2 //  VCRoot.m
 3 //  XIBAPP
 4 //
 5 //  Created by wky on 29/09/2017.
 6 //  Copyright ? 2017 wky. All rights reserved.
 7 //
 8 
 9 #import "VCRoot.h"
10 
11 @interface VCRoot ()
12 
13 @end
14 
15 @implementation VCRoot
16 
17 - (void)viewDidLoad {
18     [super viewDidLoad];
19     // Do any additional setup after loading the view from its nib.
20 }
21 
22 - (void)didReceiveMemoryWarning {
23     [super didReceiveMemoryWarning];
24     // Dispose of any resources that can be recreated.
25 }
26 
27 /*
28 #pragma mark - Navigation
29 
30 // In a storyboard-based application, you will often want to do a little preparation before navigation
31 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
32     // Get the new view controller using [segue destinationViewController].
33     // Pass the selected object to the new view controller.
34 }
35 */
36 
37 - (IBAction)pressLogin:(UIButton *)sender {
38     NSString* uName = @"Mike";
39     NSString* uPwd = @"123";
40     
41     if( [_mTFUsername.text isEqual:uName] && [_mTFPassword.text isEqual:uPwd] )
42     {
43         UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"登录成功" delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:@"朕知道了", nil];
44         
45         [alert show];
46         
47     }
48     else
49     {
50         UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"用户名或密码不正确" delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:@"朕知道了", nil];
51         
52         [alert show];
53 
54     }
55     
56     
57 }
58 -(void) touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
59 {
60     [_mTFUsername resignFirstResponder];
61     [_mTFPassword resignFirstResponder];
62 }
63 
64 
65 
66 - (IBAction)pressReg:(UIButton *)sender {
67 }
68 @end

 

以上是关于XIB 拖控件的主要内容,如果未能解决你的问题,请参考以下文章

Xib给特定view添加手势

XIB——AutoLayout添加约束

iOS - XIB之AutoLayout添加约束

iOS之用xib给控件设置圆角边框效果

为啥我的 xib 文件在 Xcode 5 中没有任何作用? [关闭]

iOS开发系列-九宫格算法-xib