ios - Add TapGestureRecogniser to UITextView -
i have looked @ similar questions , tried answers , can't them working, apologies if duplicate question.
i have 2 address fields on table view added dynamically in static cells. when user enters address in first box want question of 'copy address' appear when click on second address field , copy address if answer 'yes'. have working on tableview didselectrowatindexpath, doesn't work when user directly taps uitextview in field. have tried adding following viewdidload() function:
uitapgesturerecognizer * tap = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(handletap:)]; [self.billingaddress addgesturerecognizer:tap];
but following code doesn't fire when uitextview billingaddress tapped.
- (void)handletap:(uitapgesturerecognizer *)recognizer { nslog(@"i here"); }
i should note billingaddress defined uitextfield property , assigned cell's detail in tableview cellforrowatindexpath static cell. done using following code:
if (section == 0 && row == 3) { bfcell* cell = [self.tableview dequeuereusablecellwithidentifier:@"checkoutinputcell"]; cell.namelabel.text = @"billing address"; cell.namelabel.font = [uifont fontwithname:@"populaire" size:23.0f]; cell.textfield.placeholder = @"required"; self.billingaddress = cell.textfield; cell.textfield.keyboardtype = uikeyboardtypealphabet; return cell; }
i'm wondering if i'm assigning tap gesture wrong place , should assigned cell.textfield. on appreciated.
i think happens conflict between textfield , gesture recognizer. i'd use uitextfielddelegate
textfieldshouldbeginediting:
detect when user taps on text field.
Comments
Post a Comment