這正是我正在嘗試做的。從DetailViewController發送數據到MasterViewController
wizardviewcontroller.m
- (IBAction)onCountryClick:(id)sender {
MJDetailViewController *detailViewController = [[MJDetailViewController alloc] initWithNibName:@"MJDetailViewController" bundle:nil];
[self presentPopupViewController:detailViewController animationType:MJPopupViewAnimationSlideLeftRight];
}
用戶點擊按鈕全國彈出一個顯示了名單。
當用戶選擇一個行按鈕標題應該改變。
這是我的DetailView,
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath: (NSIndexPath *)indexPath {
WizardViewController *mj = [[WizardViewController alloc] initWithNibName:@"WizardViewController" bundle:nil];
mj.countryselected = [countryNames objectAtIndex:indexPath.row];
[mj.countryButton setTitle:mj.countryselected forState:UIControlStateNormal];
[self dismissPopupViewControllerWithanimationType:MJPopupViewAnimationFade];
}
DetailViewController
被解僱,但countryButtonTitle
沒有更新。我知道這是因爲wizardview並不令人耳目一新。我想知道在這種情況下正確的解決方法。
希望這有助於得到更好的答案。在MJDetailViewController
@protocol MJDetailViewControllerDelegate;
@interface MJDetailViewController : UIViewController
@property (nonatomic,assign) id< MJDetailViewControllerDelegate> delegate;
@end
@protocol MJDetailViewControllerDelegate <NSObject>
- (void)selectedContry:(NSString *)title;
@end
您的代碼創建WizardViewController的* new *實例並在該新實例上設置屬性。您必須設置*現有*主視圖控制器的屬性。 – 2013-04-07 13:21:58
我的主視圖控制器是WizardViewController – jack 2013-04-07 13:28:12
不完全...它是** WizardViewController的一個實例。當你創建一個新的,它是一個不同的對象。 – 2013-04-07 13:31:19