简体   繁体   中英

unable to pass data form tableview to viewcontroller in ios

hi I'm new to iOS development. in my application i have fetch datas form outside database and i viewed in tableview so now i have created on 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

#import <UIKit/UIKit.h>

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

in .m file in viewload

event.text = self.eve;

I think ff.title is not getting any value, because rest of the things you are doing is fine. Please try to print ff.title before passing it to next view.

First check dvc is your nib(xib) name.

Make exact nib name i thing your nib name should be detailviewpoliticalViewController. i checked from starting if your xib name is correct then tell me i will check next next lines

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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