問題描述:自定義了一個(gè)tableviewcell,上面有一個(gè)button,添加了一個(gè)單擊事件。tableviewcell是用xib做的,點(diǎn)擊響應(yīng)在cell的類里實(shí)現(xiàn)?,F(xiàn)在單擊button沒有響應(yīng)。疑惑:應(yīng)該跟xcode和ios版本沒有關(guān)系。我是從另一個(gè)工程直接拷貝來的,另一個(gè)工程里可以響應(yīng),這兩個(gè)工程的區(qū)別是arc和mrc,mrc的有響應(yīng),arc的沒響應(yīng),不知道有沒有關(guān)系。我換了另一種方法——在viewcontrol里處理cell,在(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath里給button添加事件并在該viewcontrol里處理事件,可還有沒有響應(yīng),只能響應(yīng)cell的點(diǎn)擊事件。請高手指教。-(IBAction)actionJiaohao:(id)sender{NSString*selectType=nil;if(self.oyised.length){[self.jiaohaosetBackgroundImage:[UIImageimageNamed:@"jiahao.png"]forState:UIControlStateNormal];selectType=@"-1";self.oyised=nil;}else{[self.jiaohaosetBackgroundImage:[UIImageimageNamed:@"jianhao.png"]forState:UIControlStateNormal];selectType=@"1";self.oyised=selectType;}OYIDefaultStore*oyids=[[OYIDefaultStorealloc]init];user_ID=[oyidsOyiRead:@"userid"];creator_Name=[oyidsOyiRead:@"name"];[selfcreateActivityView:self.superview];dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0),^{//發(fā)送信息到服務(wù)器post*publish=[[postalloc]init];[publishOyiPostPl:user_IDkeyID:selectTypeCreator:creator_NameQQID:self.QQIDHTID:niltitle:niltext:nilimage:nilphone:nilpassword:nilusername:nilurl:@"aplMyAttentionUpdate"];dispatch_async(dispatch_get_main_queue(),^{[selfstopActivityView];});});}
tableviewcell上的button不響應(yīng)點(diǎn)擊事件
郎朗坤
2019-04-19 16:11:31