I am trying to fade out the Navigation bar from my UIScrollView subclass. It calls the viewcontroller to fade this bar out, and it runs (nslogs show) but it does not fade out. But if I put the fadeout method on the viewcontroller viewdidload the fadeout works. Any ideas why it doesn't want to fade out if scrollview calls it?
scrollview.m
Code:
#import "ScrollView.h"
#import "DetailViewController.h"
@implementation ScrollView
- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event {
if (!self.dragging) {
[self.nextResponder touchesEnded: touches withEvent:event];
}
[super touchesEnded: touches withEvent: event];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"Touched!");
DetailViewController *dvc = [[DetailViewController alloc] init];
[dvc performSelector:@selector(fadeBarAway) withObject:nil afterDelay:1.0];
}
- (void)dealloc {
[super dealloc];
}
@end
viewcontroller:
Code:
- (void)fadeBarAway {
NSLog(@"hey fader!");
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
self.navigationController.navigationBar.alpha = 0.0;
[UIView commitAnimations];
}