Uitableview -[UIViewController setSelectedRowTitle:]:发送到实例0x13fab360的无法识别的选择器
我试图将数据从一个表视图单元格传递到下一个UIViewController。我也在使用导航控制器,但当我单击单元格时,它会给出错误:-Uitableview -[UIViewController setSelectedRowTitle:]:发送到实例0x13fab360的无法识别的选择器,uitableview,cell,segue,custom-cell,Uitableview,Cell,Segue,Custom Cell,我试图将数据从一个表视图单元格传递到下一个UIViewController。我也在使用导航控制器,但当我单击单元格时,它会给出错误:- -[UIViewController setSelectedRowTitle:]: unrecognized selector sent to instance 0x13fab360 我的prepareForSegue代码是我使用的下一步数据:- -(NSInteger)tableView:(UITableView *)tableView numberOfRo
-[UIViewController setSelectedRowTitle:]: unrecognized selector sent to instance 0x13fab360
我的prepareForSegue代码是我使用的下一步数据:-
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [NearBy_PlacesArray count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *TableIdentifire = @"NearMe";
NearByTableViewCell *cell = (NearByTableViewCell*)[self.tableView dequeueReusableCellWithIdentifier:TableIdentifire];
if (cell == nil)
{
cell = [[NearByTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:TableIdentifire];
}
NearByPlace *nearBy = [NearBy_PlacesArray objectAtIndex:indexPath.row];
cell.NearBy_Thumbnail_Image.image = [UIImage imageNamed:nearBy.NearByImageName];
cell.NearBy_TitleLabel.text = nearBy.NearByPlaceName;
cell.NearBy_NoLabel.text = nearBy.NearByPlace_no;
return cell;
}
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"ShowNearByPlaces"])
{
NSIndexPath *indexPath = nil;
NearByPlace *nearPlace = nil;
indexPath = [self.tableView indexPathForSelectedRow];
nearPlace = [NearBy_PlacesArray objectAtIndex:indexPath.row];
NSLog(@"indexPath-- %@ \n" , indexPath);
NSLog(@"recipe-- %@ \n " , nearPlace);
nearByPlaceDetail_ViewController *destViewController = segue.destinationViewController;
destViewController.SelectedRowTitle = nearPlace;
}
}
Mantosh,您可以简单地执行以下操作:
- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
静态NSString*AstIdentifier=@“单元格”;
UITableViewCell*aCell=[tableView dequeueReusableCellWithIdentifier:AstIdentifier]
}UILabel *aLblPlaceName=(UILabel*)[aCell viewWithTag:1]; aLblPlaceName.text=[NSString stringWithFormat:@"%@", [arrPlaces objectAtIndex:indexPath.row]]; return aCell;
- (void)tableView:(UITableView*)tableView未选择RowatineXpath:(NSIndexPath*)indexPath { strStoreValue=[NSString stringWithFormat:@“%@,[arrPlaces objectAtIndex:indexPath.row]]; [self-PerformsgueWithIdentifier:@“detailViewSegue”发件人:self]; }
- (void)prepareForSegue:(UIStoryboardSegue*)segue发送方:(id)发送方 { DetailViewController*aObjDetailVC=segue.destinationViewController; aObjDetailVC.strPlace=strStoreValue; }