mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-25 04:30:38 +00:00

git-subtree-dir: submodules/Display git-subtree-mainline: 9bc996374ffdad37aef175427db72731c9551dcf git-subtree-split: 7bd11013ea936e3d49d937550d599f5816d32560
68 lines
1.2 KiB
Objective-C
68 lines
1.2 KiB
Objective-C
#import "NavigationBarProxy.h"
|
|
|
|
@interface NavigationBarProxy ()
|
|
{
|
|
NSArray *_items;
|
|
}
|
|
|
|
@end
|
|
|
|
@implementation NavigationBarProxy
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
{
|
|
self = [super initWithFrame:frame];
|
|
if (self != nil)
|
|
{
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)pushNavigationItem:(UINavigationItem *)item animated:(BOOL)animated
|
|
{
|
|
[self setItems:[[self items] arrayByAddingObject:item] animated:animated];
|
|
}
|
|
|
|
- (UINavigationItem *)popNavigationItemAnimated:(BOOL)animated
|
|
{
|
|
NSMutableArray *items = [[NSMutableArray alloc] initWithArray:[self items]];
|
|
UINavigationItem *lastItem = [items lastObject];
|
|
[items removeLastObject];
|
|
[self setItems:items animated:animated];
|
|
return lastItem;
|
|
}
|
|
|
|
- (UINavigationItem *)topItem
|
|
{
|
|
return [[self items] lastObject];
|
|
}
|
|
|
|
- (UINavigationItem *)backItem
|
|
{
|
|
NSLog(@"backItem");
|
|
return nil;
|
|
}
|
|
|
|
- (NSArray *)items
|
|
{
|
|
if (_items == nil)
|
|
return @[];
|
|
return _items;
|
|
}
|
|
|
|
- (void)setItems:(NSArray *)items
|
|
{
|
|
[self setItems:items animated:false];
|
|
}
|
|
|
|
- (void)setItems:(NSArray *)items animated:(BOOL)animated
|
|
{
|
|
NSArray *previousItems = _items;
|
|
_items = items;
|
|
|
|
if (_setItemsProxy)
|
|
_setItemsProxy(previousItems, items, animated);
|
|
}
|
|
|
|
@end
|