iOSUITextField或UITextView的内容是否为空-创新互联
//判断正在编辑的UITextField或UITextView的内容是否为空,判断正在编辑的UITextField或UITextView的内容是否为空,以此来控制button的点亮状态
十年专注成都网站制作,成都企业网站定制,个人网站制作服务,为大家分享网站制作知识、方案,网站设计流程、步骤,成功服务上千家企业。为您提供网站建设,网站制作,网页设计及定制高端网站建设服务,专注于成都企业网站定制,高端网页制作,对成都石牌坊等多个领域,拥有多年的网站营销经验。#pragma mark- UITextFieldDelegate
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
NSMutableString * changedString=[[NSMutableString alloc]initWithString:textField.text];
[changedString replaceCharactersInRange:range withString:string];
if (changedString.length!=0) {
self.navigationItem.rightBarButtonItem.enabled=YES;
}else{
self.navigationItem.rightBarButtonItem.enabled=NO;
}
return YES;
}
#pragma mark- UITextViewDelegate
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString*)text
{
NSMutableString * changedString=[[NSMutableString alloc]initWithString:textView.text];
[changedString replaceCharactersInRange:range withString:text];
if (changedString.length!=0) {
self.navigationItem.rightBarButtonItem.enabled=YES;
}else{
self.navigationItem.rightBarButtonItem.enabled=NO;
}
return YES;
}
//一些判断技巧
BOOL
iftfPostNametextlength1
//01
tfPostName.. = [ redColor].;
tfPostName.. =1.0;
tfPostName.. =5.0;
returnNO
else if (.text.length<1){
//02
tfPositionType.. = [ redColor].;
tfPositionType.. =1.0;
tfPositionType.. =5.0;
returnNO
elseiftfPeopleNumtextlength1
//03
tfPeopleNum.. = [ redColor].;
tfPeopleNum.. =1.0;
tfPeopleNum.. =5.0;
returnNO
elseiftfWagestextlength1
//04
tfWages.. = [ redColor].;
tfWages.. =1.0;
tfWages.. =5.0;
returnNO
elseiftfUnittextlength1
//05
tfUnit.. = [ redColor].;
tfUnit.. =1.0;
tfUnit.. =5.0;
returnNO
elseiftfStartDatetextlength1
//07
tfStartDate.. = [ redColor].;
tfStartDate.. =1.0;
tfStartDate.. =5.0;
returnNO
elseiftfEndDatetextlength1
//08
tfEndDate.. = [ redColor].;
tfEndDate.. =1.0;
tfEndDate.. =5.0;
returnNO
elseiftfSescribetextlength1
//09
tfSescribe.. = [ redColor].;
tfSescribe.. =1.0;
tfSescribe.. =5.0;
returnNO
elseiftfContactPersontextlength1
//11
tfContactPerson.. = [ redColor].;
tfContactPerson.. =1.0;
tfContactPerson.. =5.0;
returnNO
else if ( .text.length<1){
//12--
tfContactPhone.. = [ redColor].;
tfContactPhone.. =1.0;
tfContactPhone.. =5.0;
returnNO
elseiftfJobAreatextlength1
//13
tfJobArea.. = [ redColor].;
tfJobArea.. =1.0;
tfJobArea.. =5.0;
returnNO
else if (.text.length<1){
//14--
tfDetailAddress.. = [ redColor].;
tfDetailAddress.. =1.0;
tfDetailAddress.. =5.0;
returnNO
elseiftfUnittextlength1
//15
tfUnit.. = [ redColor].;
tfUnit.. =1.0;
tfUnit.. =5.0;
returnNO
else
returnYES
//
BOOLUITextViewNSRangeNSString
* changedString=[[ alloc]initWithString:tfSescribe.];
[changedString :range :text];
iflength1
[ notifyWithText:@"" andDetail:@"请完善发布信息"];
else
请完善发布信息
;
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
当前题目:iOSUITextField或UITextView的内容是否为空-创新互联
本文链接:http://azwzsj.com/article/eicdd.html