English 中文(简体)
如果在用户与其互动时,新案文领域有特别的插图,如何编辑成文
原标题:How to edit text of uitextfield if uitextfield has a particular string when user interact with it

i m 形成一种形式。 因此,当用户点击提交纽顿时,即检查是否填满了所有自成文的领域:

-(BOOL)checkUITextField{
    BOOL flag = YES;
    if(cognome.text.length==0){
        flag=NO;
        cognome.backgroundColor=[UIColor redColor];
        cognome.text=@"CAMPO OBBLIGATORIO"; 
    }else if(indirizzo.text.length==0){
        flag=NO;
        indirizzo.backgroundColor=[UIColor redColor];
        indirizzo.text=@"CAMPO OBBLIGATORIO"; 
    }else if(citta.text.length==0){
        flag=NO;
        citta.backgroundColor=[UIColor redColor];
        citta.text=@"CAMPO OBBLIGATORIO"; 
    }
}

Now, if user click on one of the uitextfield with background red and string "CAMPO OBBLIGATORIO", i want to clear text and set back color to white. i try using uitextfielddelegate and implementing textFieldShouldBeginEditing checking this:

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
    if([textField.text isEqualToString:@"CAMPO OBBLIGATORIO"]){
        textField.text=@"";
        textField.backgroundColor=[UIColor whiteColor];
    }
}

没有发生。

这样一来,就试图增加一种交易,并用西比语将它添加到每个建筑区,但是没有发生任何事情。 可以做些什么?

最佳回答

我只是用你的逻辑 mo倒了考验,而应该做的是罚款。 我的猜测是,你没有指派代表。 在<代码>Interface Buildinger中,你需要在上 c升,并抽出你希望作为代表的物体。

如果你需要填写<编码>UIText Field,我可能会考虑改变检查方式。 如果你在晚些时候将自己的用词加以分类,则对用户界面(@ CAMPO OBBLIGATORIO>)进行检查可能会中断。

问题回答

暂无回答




相关问题
Asynchronous request to the server from background thread

I ve got the problem when I tried to do asynchronous requests to server from background thread. I ve never got results of those requests. Simple example which shows the problem: @protocol ...

objective-c: Calling a void function from another controller

i have a void, like -(void) doSomething in a specific controller. i can call it in this controller via [self doSomething], but i don t know how to call this void from another .m file. I want to call ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

NSUndoManager and runModalForWindow:

I have a simple Core Data app which displays a list of entities in the main window. To create or add new entities, I use a second modal window with a separate managed object context so changes can be ...

NSMutableArray values becoming "invalid"

I m trying to show a database information in a tableview and then the detailed information in a view my problem is as follow: I created a NSMutableArray: NSMutableArray *myArray = [[NSMutableArray ...

iPhone numberpad with decimal point

I am writing an iPhone application which requires the user to enter several values that may contain a decimal point (currency values, percentages etc.). The number of decimal places in the values ...

热门标签