Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (29 sloc) 1.2 KB
//
// UITabBarController+DTResurrection.m
// DTResurrectionKit
//
// Created by Daniel Tull on 09.11.2009.
// Copyright 2009 Daniel Tull. All rights reserved.
//
#import "UITabBarController+DTResurrection.h"
@implementation UITabBarController (DTResurrection)
- (id)initWithResurrector:(DTResurrector *)resurrector {
if (!(self = [self init])) return nil;
self.viewControllers = [resurrector objectForKey:@"viewControllers"];
self.selectedIndex = [[resurrector objectForKey:@"selectedIndex"] integerValue];
UIViewController *mvc = [resurrector objectForKey:@"modalViewController"];
if (mvc) [resurrector viewController:self.selectedViewController unpackedModalViewController:mvc];
return self;
}
- (void)encodeToResurrector:(DTResurrector *)resurrector {
[resurrector setObject:self.viewControllers forKey:@"viewControllers"];
[resurrector setObject:[NSNumber numberWithInteger:self.selectedIndex] forKey:@"selectedIndex"];
if (self.modalViewController) {
if ([self isEqual:self.modalViewController.parentViewController])
[resurrector setObject:self.modalViewController forKey:@"modalViewController"];
}
}
- (UIViewController *)frontViewController {
return self.selectedViewController;
}
@end
Something went wrong with that request. Please try again.