我面臨的問題是在DetailsOfPeopleViewController
的標籤中顯示AddNotesViewController
類的字符串的值。將值從一個類傳遞到其他類
我想要做的就是我們在1班的UITextView
中輸入的內容,應顯示在另一班的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.....)
}
請指引我在哪裏,我在做的錯誤。
可以請你告訴我,使用它的代碼你導航到DetailsOfPeopleViewController – Rajneesh071