简体   繁体   English

无法将数据表单TableView传递给iOS中的ViewController

[英]unable to pass data form tableview to viewcontroller in ios

hi I'm new to iOS development. 嗨,我是iOS开发的新手。 in my application i have fetch datas form outside database and i viewed in tableview so now i have created on detailviewcontroller. 在我的应用程序中,我已经从数据库外部获取数据表单,并在tableview中进行了查看,因此现在我在detailviewcontroller上创建了。 to give clear view about the data but its not working. 提供有关数据的清晰视图,但不起作用。

the code i used. 我使用的代码。

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    detailviewpoliticalViewController *dvc =[[detailviewpoliticalViewController alloc]initWithNibName:@"dvc" bundle:nil];

    fieldpolitical * ff =[eventarray objectAtIndex:indexPath.row];

    dvc.eve =ff.title;

    [self.navigationController pushViewController:dvc animated:YES];
}

this is the declaration and and initialization of the data in .h file 这是.h文件中数据的声明和初始化

#import <UIKit/UIKit.h>

@interface detailviewpoliticalViewController : UIViewController
@property (nonatomic,strong) NSString *eve;
@property (strong, nonatomic) IBOutlet UILabel *event;
@end

in .m file in viewload 在Viewload的.m文件中

event.text = self.eve;

I think ff.title is not getting any value, because rest of the things you are doing is fine. 我认为ff.title没有任何价值,因为您所做的其他事情都还不错。 Please try to print ff.title before passing it to next view. 请在将ff.title传递到下一个视图之前尝试打印它。

First check dvc is your nib(xib) name. 首先检查dvc是您的笔尖(xib)名称。

Make exact nib name i thing your nib name should be detailviewpoliticalViewController. 使确切的笔尖名称,我的东西您的笔尖名称应为detailviewpoliticalViewController。 i checked from starting if your xib name is correct then tell me i will check next next lines 我从头开始检查您的xib名称是否正确,然后告诉我我将检查下一行

detailviewpoliticalViewController *dvc =[[detailviewpoliticalViewController alloc]initWithNibName:@"dvc" bundle:nil];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM