Ich möchte nach Klicken auf den Knopf in der Zelle zum View Controller wechseln. Ich versuche es mit der Verwendung von Klick-Taste:Schaltfläche in der Zelle und verschieben Ansicht Controller
- (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;}
Hier searchBtnClicked ist:
- (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"];
}
}
zeigen Toast, aber nicht drücken Serien-View-Controller zu suchen. Was passiert hier? Bitte hilf mir.
wo ist 'searchBtnClicked' in? Und können Sie 'searchVC' überprüfen? ist es "nil"? –
searchBtnClicked '[cell.btnSearch addTarget: Selbstaktion: @selector (searchBtnClicked :) forControlEvents: UIControlEventTouchUpInside];' is here. Und suche VC nicht nil, überprüfe ich mit anderen VC und gleichen Ergebnis. – Rin
Warum ist dies mit Swift markiert? – toddg