問題描述:自定義了一個tableviewcell,上面有一個button,添加了一個單擊事件。tableviewcell是用xib做的,點擊響應在cell的類里實現。現在單擊button沒有響應。疑惑:應該跟xcode和ios版本沒有關系。我是從另一個工程直接拷貝來的,另一個工程里可以響應,這兩個工程的區別是arc和mrc,mrc的有響應,arc的沒響應,不知道有沒有關系。我換了另一種方法——在viewcontrol里處理cell,在(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath里給button添加事件并在該viewcontrol里處理事件,可還有沒有響應,只能響應cell的點擊事件。請高手指教。-(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),^{//發送信息到服務器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不響應點擊事件
郎朗坤
2019-04-19 16:11:31