1
如何將值從一個控制器傳遞給另一個?我使用StoryBoard。如何將值NSLabel從一個表示形式傳遞給另一個表示形式。與故事板
-(void) prepareForSegue:(UIStoryboardPopoverSegue *)segue sender:(id)sender
{
if ([segue.identifier hasPrefix:@"FinishController"]) {
FinishController *asker = (FinishController *) segue.destinationViewController;
asker.FinishDesc = @"What do you want your label to say?";
asker.FinishTitle = @"Label text";
asker.FinishPoint = @"asdas";
}
}
我想出現在第一個視圖中突出顯示的文本視圖。我想這樣的東西應該看起來像這樣: UIStoryboard * finish = [UIStoryboard storyboardWithName:@「MainStoryboard」bundle:nil];
UIViewController *viewController = [finish instantiateViewControllerWithIdentifier:@"FinishController"];
viewController.modalPresentationStyle = UIModalPresentationPageSheet;
[self presentModalViewController:viewController animated:YES];
finishcontroller:
- (void)viewDidLoad
{
self.lblFinishTitle.text=self.FinishTitle;
self.lblFinishDesc.text = self.FinishDesc;
self.lblFinishPoint.text=self.FinishPoint;
[super viewDidLoad];
// Do any additional setup after loading the view.
}
你能舉個例子嗎? – Feor 2012-07-13 04:25:10
在Example1.h中,在標題區域放下「extern UILabel * testLabel」。然後在Example1.m的標題區域放下「UILabel * testLabel」。然後在Example2.m中要使用該值的地方,包含Example1.h。 – xcoder 2012-07-13 12:47:50
你的決定非常糟糕= \ – Feor 2012-07-13 12:56:13