天天看點

登入 ,注冊 界面實作 代碼

    //1、賬号标簽

UILabel *idLalel = [[UILabel alloc] initWithFrame:CGRectMake(30, 100, 70, 30)];      

    //2、設定⽂文本控制相關的屬性

idLalel.text = @"賬号:";
    [self addSubview:idLalel];
    [idLalel release];      

    //1、密碼标簽

UILabel *passLalel = [[UILabel alloc] initWithFrame:CGRectMake(30, 200, 70, 30)];      

    //2、設定⽂文本控制相關的屬性

passLalel.text = @"密碼:";
    [self addSubview:passLalel];
    [passLalel release];      

    //賬号輸入框

UITextField *idTexfield = [[UITextField alloc] initWithFrame:CGRectMake(100, 100, 160, 30)];      

    //設定邊界屬性

idTexfield.tag = 1001;
    idTexfield.borderStyle = UITextBorderStyleBezel;
    idTexfield.placeholder = @"請輸入賬号...";
    idTexfield.delegate = self;
    [self addSubview:idTexfield];
    [idTexfield release];      

    //密碼輸入框

UITextField *passTexfield = [[UITextField alloc] initWithFrame:CGRectMake(100, 200, 160, 30)];      

    //設定邊界屬性

passTexfield.tag = 1002;
    passTexfield.borderStyle = UITextBorderStyleBezel;
    passTexfield.secureTextEntry = YES;   //以圓點形式輸入
    passTexfield.keyboardType =  UIKeyboardTypeNumberPad;//鍵盤形式
    passTexfield.returnKeyType = UIReturnKeyNext;
    passTexfield.placeholder = @"請輸入密碼...";
    passTexfield.delegate = self;

    [self addSubview:passTexfield];
    [passTexfield release];      

    //放置按鈕

    //登入

UIButton *loginButton = [UIButton buttonWithType:UIButtonTypeSystem];
    loginButton.frame = CGRectMake(30, 250, 60, 30);
    [loginButton setTitle:@"登入" forState:UIControlStateNormal];
    //添加事件
    [loginButton addTarget:self action:@selector(loginAction:)
          forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:loginButton];      

    //注冊

UIButton *registerButton = [UIButton buttonWithType:UIButtonTypeSystem];
    registerButton.frame = CGRectMake(120, 250, 60, 30);
    [registerButton setTitle:@"注冊" forState:UIControlStateNormal];
    // [loginButton addTarget:self action:@selector(login:)
    //       forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:registerButton];      

    //密碼找回

UIButton *regetButton = [UIButton buttonWithType:UIButtonTypeSystem];
    regetButton.frame = CGRectMake(220, 250, 60, 30);
    [regetButton setTitle:@"密碼找回" forState:UIControlStateNormal];
    // [loginButton addTarget:self action:@selector(login:)
    //       forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:regetButton];