單擊單元格中的按鈕後,我想要移動到視圖控制器。我嘗試用點擊按鈕:單元格中的按鈕和移動視圖控制器
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger rowOfCell = [indexPath row];
TwoParramCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TwoParramCell" forIndexPath:indexPath];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
NSDictionary *dic = [self.arrayGoodInfo objectAtIndex:indexPath.row];
cell.delegate = self;
if (rowOfCell == 0) {
cell.btnSearch.hidden = NO;
}
cell.btnSearch.tag = indexPath.row;
[cell.btnSearch addTarget:self action:@selector(searchBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
cell.lblTitle.text = [dic objectForKey:@"stockModelName"];
cell.isMeterial = @"NO";
cell.txtContent.text = @"";
cell.txtContent.tag = indexPath.row;
if ([dic objectForKey:@"serial"]) {
cell.txtContent.text = [dic objectForKey:@"serial"];
}else{
cell.txtContent.text = @"";
}
return cell;}
這裏是searchBtnClicked:
- (void)searchBtnClicked: (UIButton *) sender{
if (sender.tag == 0){
SearchSerialVC *searchVC = [[SearchSerialVC alloc] initWithNibName:@"SearchSerialVC" bundle:nil];
[self.navigationController pushViewController:searchVC animated:YES];
[VTService showToastWithText:@"Search Serial"];
}
}
吐司節目,但不能推到搜索串行視圖控制器。這裏發生了什麼?請幫幫我。
哪裏是'searchBtnClicked'嗎?你可以檢查'searchVC'嗎?它是'零'嗎? –
searchBtnClicked'[cell.btnSearch addTarget:self action:@selector(searchBtnClicked :) forControlEvents:UIControlEventTouchUpInside];'在這裏。並且搜索VC不是零,我檢查其他VC和相同的結果。 – Rin
爲什麼用Swift標記? – toddg