UITextField 屬性集錦大全

借鑑文章出自

    textFields = [[UITextFieldalloc]initWithFrame:CGRectMake(110,64,100,20)];

    textFields.delegate =self;

    textFields.placeholder =@"教案看得很費勁";

    textFields.textAlignment =NSTextAlignmentCenter;

    textFields.textColor = [UIColorblackColor];

    textFields.font = [UIFontboldSystemFontOfSize:13];

    textFields.returnKeyType =UIReturnKeyDefault;

    textFields.borderStyle =UITextBorderStyleLine;

    textFields.keyboardType=UIKeyboardTypeNumberPad;

    [self.viewaddSubview:textFields];

    

   button1Label = [[UILabelalloc]init];

   button1Label.frame =CGRectMake(80,94,200,40);

    button1Label.font = [UIFontboldSystemFontOfSize:30];

    button1Label.textAlignment =NSTextAlignmentCenter;

    button1Label.layer.borderColor = [UIColorlightGrayColor].CGColor;

    button1Label.layer.borderWidth =1.0;

    button1Label.backgroundColor = [UIColor orangeColor];

     button1Label.layer.masksToBounds = YES;

     button1Label.layer.cornerRadius = 15;



    [button1LabelsetTextColor:[UIColorredColor]];

    [self.viewaddSubview:button1Label];


}

-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{

   

    NSString * toBeString = [textField.textstringByReplacingCharactersInRange:rangewithString:string];//得到輸入框的內容

   button1Label.text = toBeString;

    

    return YES;


}



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章