I am making an App in which i have a view where i am showing friends details.
So, If i need to change the details. I will have to check on the label to change it.
Here,I have set tag value for each label.
If the user presses a label the new text field will appear on the view and the user can change the Details.
So for this i have written touch began method in which i am checking the touch value…
But whenever i am touching any label i am getting the tag value of view as zero where as i should get the tag value of the label on wich i have clicked .
My code is shown below…
txtTmp = [[UITextField alloc] init];
//txtTmp is the textfield which should appear as super view of the label where i have clicked
txtTmp.delegate=self;
self.lblName.tag=11;
UITouch *touch = [touches anyObject];
//here i am getting the tag value as 0 even if i have enabled the user interaction…
NSLog(@"view.tag = %d",touch.view.tag);
if(touch.view.tag==11) {
[txtTmp setFrame:CGRectMake(162, 43, 138, 50)];
txtTmp.text=lblName.text;
[self.view addSubview:txtTmp];
[txtTmp becomeFirstResponder];
temp=1;
}
If u have any problem regarding my question..Please get back to me….
Thanks,
you should enable user interaction of self.lblName.
Also you can check for touched label in touchesbegan method using viewWithTag message: