ios - Unable to click the label in the UITableCell -
in table cell having different controls, problem facing unable tap control cell, in code had used single tap username label when click it's not going usernametap: selector. can me how solve issue
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"messagingcell"; ptsmessagingcell *cell = [self.tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[ptsmessagingcell alloc] initmessagingcellwithreuseidentifier:cellidentifier]; nsstring *struserid, *strusername; struserid = userid[indexpath.row]; strusername = username[indexpath.row]; if ([loginusername isequaltostring:strusername]) { cell.rightutilitybuttons = [self rightbuttons]; } else { cell.rightutilitybuttons = [self rightreportbuttons]; } } cell.selectionstyle = uitableviewcellselectionstylenone; nsstring *struserid, *strusername; struserid = userid[indexpath.row]; strusername = username[indexpath.row]; if ([loginusername isequaltostring:strusername]) { cell.rightutilitybuttons = [self rightbuttons]; } else { cell.rightutilitybuttons = [self rightreportbuttons]; } cell.sent = no; [cell.messagelabel settext:commments[indexpath.row]]; cell.messagelabel.userinteractionenabled = yes; [cell.username settext:username[indexpath.row]]; uitapgesturerecognizer *singletap = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(usernametap:)]; singletap.numberoftapsrequired = 1; singletap.numberoftouchesrequired = 1; [cell.username addgesturerecognizer:singletap]; [cell.username setuserinteractionenabled:yes];
Comments
Post a Comment