Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions YSLContainerViewController/YSLContainerViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
@property (nonatomic, strong) UIColor *menuBackGroudColor;
@property (nonatomic, strong) UIColor *menuIndicatorColor;

- (id)initWithControllers:(NSArray *)controllers
topBarHeight:(CGFloat)topBarHeight
parentViewController:(UIViewController *)parentViewController
selectedIndex:(NSInteger)index;

- (id)initWithControllers:(NSArray *)controllers
topBarHeight:(CGFloat)topBarHeight
parentViewController:(UIViewController *)parentViewController;
Expand Down
13 changes: 11 additions & 2 deletions YSLContainerViewController/YSLContainerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ @implementation YSLContainerViewController
- (id)initWithControllers:(NSArray *)controllers
topBarHeight:(CGFloat)topBarHeight
parentViewController:(UIViewController *)parentViewController
{
selectedIndex:(NSInteger)index {
self = [super init];
if (self) {

Expand All @@ -35,6 +35,7 @@ - (id)initWithControllers:(NSArray *)controllers
_titles = [[NSMutableArray alloc] init];
_childControllers = [[NSMutableArray alloc] init];
_childControllers = [controllers mutableCopy];
_currentIndex = index;

NSMutableArray *titles = [NSMutableArray array];
for (UIViewController *vc in _childControllers) {
Expand All @@ -45,6 +46,13 @@ - (id)initWithControllers:(NSArray *)controllers
return self;
}

- (id)initWithControllers:(NSArray *)controllers
topBarHeight:(CGFloat)topBarHeight
parentViewController:(UIViewController *)parentViewController
{
return [self initWithControllers:controllers topBarHeight:topBarHeight parentViewController:parentViewController selectedIndex:0];
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
Expand Down Expand Up @@ -90,8 +98,9 @@ - (void)viewDidLoad {
[_menuView setItemTitleArray:self.titles];
[self.view addSubview:_menuView];
[_menuView setShadowView];
[_menuView layoutIfNeeded];

[self scrollMenuViewSelectedIndex:0];
[self scrollMenuViewSelectedIndex:_currentIndex];
}

#pragma mark -- private
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.