这正是我想要做的。
wizardviewcontroller.m
- (IBAction)onCountryClick:(id)sender {
MJDetailViewController *detailViewController = [[MJDetailViewController alloc] initWithNibName:@"MJDetailViewController" bundle:nil];
[self presentPopupViewController:detailViewController animationType:MJPopupViewAnimationSlideLeftRight];
}
用户单击国家/地区按钮,弹出窗口显示列表。
当用户选择行按钮标题时应该更改。
这是我的详细视图,
-(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
正在解雇,但{{1}}没有更新。我知道这是因为wizardview不令人耳目一新。在这种情况下,我想知道正确的解决方法。
希望这有助于获得更好的答案。
答案 0 :(得分:2)
在MJDetailViewController
@protocol MJDetailViewControllerDelegate;
@interface MJDetailViewController : UIViewController
@property (nonatomic,assign) id< MJDetailViewControllerDelegate> delegate;
@end
@protocol MJDetailViewControllerDelegate <NSObject>
- (void)selectedContry:(NSString *)title;
@end
并打电话给
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath: (NSIndexPath *)indexPath {
NSString *title = [countryNames objectAtIndex:indexPath.row];
if ([self.delegate respondsToSelector:@selector(selectedContry:)]) {
[self.delegate selectedContry:title];
}
[self dismissPopupViewControllerWithanimationType:MJPopupViewAnimationFade];
}
在MJDetailViewControllerDelegate
)
protocol
作为WizardViewController.h
现在在selectedContry:
中实施WizardViewController.m
方法,例如:
- (void)selectedContry:(NSString *)title
{
[self.countryButton setTitle:title forState:UIControlStateNormal];
}
希望它对你有所帮助。