-1
用戶已經輸入的最小字符的UITextField後我有一個iPhone應用程序,其中我有一個的UITextField其最大字符長度I SET使用委託方法:需要啓用一個UIButton使用委託方法在IOS
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
然而,我現在意識到,我還需要啓用UIButton *myButton
,當用戶在同一個UITextField中輸入至少一個字符時,我就擁有這個UIButton *myButton
。我如何實現這一點?
這裏是我的相關代碼,我在我的委託方法目前所面對的:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
NSUInteger newLength = [textField.text length] + [string length] - range.length;
return (newLength > 45) ? NO : YES;
}
在此先感謝所有誰答覆。