我AddNotesViewController
在DetailsOfPeopleViewController
.
我想做的就是我们在UITextView
1 个班级中输入的任何内容,应该在UILabel
另一个班级中显示。
在文件中AddNotesViewController.h
UITextView *txtView;
@property(nonatomic,retain)IBOutlet UITextView *txtView;
在文件中AddNotesViewController.m
@synthesize txtView;
之后,当我单击选项卡栏项目“保存”时,它应该保存在数据库中,它保存到数据库并显示值,但它没有将值传递给
DetailsOfPeopleViewController
.
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item{
NSLog(@"Tabbar selected itm %d",item.tag);
switch (item.tag) {
case 0:
appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NotesTable *crashNotInvolvingObj11 = (NotesTable *)[NSEntityDescription
insertNewObjectForEntityForName:@"NotesTable" inManagedObjectContext:[appDelegate managedObjectContext]];
// CameraViewController *camera=[[CameraViewController alloc] init];
crashNotInvolvingObj11.personNote=[NSString stringWithFormat:@"%@",txtView.text];
DetailsOfPeopleViewController *detail=[DetailsOfPeopleViewController alloc];
detail.testPersonNotesStr =[NSString stringWithFormat:@"%@",txtView.text];
//(value of testPersonNotesStr is DISPLYING here... )
[appDelegate saveContext];
[detail release];
break;
..................
}
在DetailsOfPeopleViewController.h
NSString *testPersonNotesStr;
UILabel *PersonNotesLbl;
@property(nonatomic,retain)IBOutlet UILabel *PersonNotesLbl;
@property(nonatomic,retain) NSString *testPersonNotesStr;
在DetailsOfPeopleViewController.m
@synthesize PersonNotesLbl;
@synthesize testPersonNotesStr;
- (void)viewDidLoad
{
[super viewDidLoad];
[PersonNotesLbl setText:testPersonNotesStr];
NSLog(@"PERSON NOTE is........ %@",testPersonNotesStr);
//(value of testPersonNotesStr is NOT DISPLYING here..... )
}
请指导我在哪里做错了。