Reputation: 4936
I have looked through the site for answers but nothing seem to have helped me
This is my scenario I have a main view called settingsView. A subview, AboutView is called from settingsView using the following
aboutView = [[AboutView alloc] initWithNibName:@"AboutView" bundle:nil];
CGRect theFrame = aboutView.view.frame;
theFrame.origin = CGPointMake(330,50);
aboutView.view.frame = theFrame;
theFrame.origin = CGPointMake(0,50);
theFrame.size.width=320;
theFrame.size.height=360;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5f];
aboutView.view.frame = theFrame;
[UIView commitAnimations];
[self.view addSubview:aboutView.view];
I would like to call a method or even viewDidAppear method in settingsView once aboutView is dismissed.
I have tried almost all the ways i could find in this forum
In the aboutView, i have tried [self.view.superview viewDidAppear]; [self.parentViewControllers ...] //Returns null, since i am not using presentViewController
I have read suggestions on setting delegate, but for whatever reason i cannot set the delegate for the aboutView.
Any suggestions?
Upvotes: 0
Views: 945
Reputation: 4936
- (void)viewController {
for (UIView* next = [self.view superview]; next; next = next.superview) {
UIResponder* nextResponder = [next nextResponder];
if ([nextResponder isKindOfClass:[UIViewController class]]) {
[(UIViewController*)nextResponder viewWillAppear:YES];
}
}
}
I have used the above code from Three20 library. Defined a method in the subview and called it. It works, but is this the right way to do it? Any other simpler way?
Thanks
Upvotes: 1