Chirag S
Chirag S

Reputation: 364

iphone UITextField changes in a UITableView with a UIButton

Screen shot

here problem is that when i pressed first row Plus button it change value of second Qty.

i need to change particular Qty change as per row select.

i also given viewWithtag on textfield but can't work properly.

thanks in advance.

Upvotes: 0

Views: 157

Answers (2)

Anand
Anand

Reputation: 1973

set the tag for UIButton & UITextField as:

set Button tag as [indexpath row]+1 set Textfield tag as ([indexpath row]+1)* 10

so there will be no mismatch of tags

When a button is pressed check the condition like this:

UITextField * textfield = (UITextField *)[self.view viewWithTag:([sender tag]+1)*10];
if([sender tag] == 1)
textfield.text = //value you want to set

Upvotes: 2

Developer
Developer

Reputation: 6465

set tag of textfield equal to the [indexpath row].

Upvotes: 0

Related Questions