I have a iOS 5 project nearly completed, but there's one View missing everywhere which is the same. It's an alternative to the standard NavigationBar, you can go "back" in the navigation hierarchy with a swipe and it's animating nicely.
Ok, because it's hard to do the layout by code I created the empty IB document (HeaderView.xib) where I have a view containing subview and etc. I had the animation code before so I just created a UIView subclass ("HRAnimationView") (and wrote the name of it in the xib's inspectors "Custom Class" field, also hooked up the subviews to outlets) with a method:
- (void)loadAnimation {…}
and a second one (this is the delegate-method for finished animations):
- (void)animationDidStop:(NSString*)animationID finished:(NSNumber*)finished context:(void*)context {}
...this is where all the animation stuff happens and calling itself over and over till it's finished...
In the storyboard I have a subview with exact the same dimensions (and the outlet for it) and wanted to load the XIB (in the viewDidLoad-method of the corresponding controller) with:
NSArray *bundle = [[NSBundle mainBundle] loadNibNamed:@"HeaderView" owner:self options:nil];
HRAnimationView *view;
for (id object in bundle) {
NSLog(@"%@",object);
if ([object isKindOfClass:[UIView class]])
view = (HRAnimationView *)object;
}
self.headerView = view;
[self.view setNeedsDisplay];
[view loadAnimation];
BUT the headerView is EMTPY!! (also UIView *view didn't worked, nor owner:self.headerView)
…the Log just gives me:
<HRAnimationView: 0x3f1890; frame = (0 0; 240 49); autoresize = RM+BM; layer = <CALayer: 0x3f18d0>>
…
WHAT IS the problem?? There's also no compilation failure!
I don't get it, why is the xib TOTALLY worthless in my case?!