PlaceHolder animates when start typing in TextField in iOS

前端 未结 6 1245
忘了有多久
忘了有多久 2021-01-31 05:22

How to set this type of animation in UITextField? Nowadays, Many apps are using this.

6条回答
  •  有刺的猬
    2021-01-31 05:45

    You can try using JSInputField which supports data validations as well.

    JSInputField *inputField = [[JSInputField alloc] initWithFrame:CGRectMake(10, 100, 300, 50)];
    [self.view addSubview:inputField];
    [inputField setPlaceholder:@"Enter Text"];
    [inputField setRoundedCorners:UIRectCornerAllCorners];
    [inputField addValidationRule:JSCreateRuleNotNullValue]; //This will validate field for null value. It will show error if field is empty.
    [inputField addValidationRule:JSCreateRuleNumeric(2)];  //This will validate field for numeric values and restrict to enter value upto 2 decimal places.
    

提交回复
热议问题