Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add scrolling to the plugin list. #2

Merged
merged 1 commit into from
Dec 3, 2017
Merged
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
39 changes: 26 additions & 13 deletions Core/SnapShotDebuggingWindow/PluginListViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,34 +54,47 @@ -(instancetype)initWithPluginModule:(HYPPluginModule *)module pluginView:(UIView
@interface PluginListViewController ()

@property (nonatomic) NSArray<PluginContainerView *> *containerViews;
@property (nonatomic) NSMutableArray<UITapGestureRecognizer *> *tapGestures;
@property (nonatomic) UIStackView *pluginList;
@property (nonatomic) UIScrollView *pluginScrollView;

@end

@implementation PluginListViewController

- (void)viewDidLoad {
[super viewDidLoad];

self.view.backgroundColor = [UIColor clearColor];

self.pluginScrollView = [[UIScrollView alloc] init];
self.pluginScrollView.translatesAutoresizingMaskIntoConstraints = false;
[self.view addSubview:self.pluginScrollView];

[self.pluginScrollView.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor].active = true;
[self.pluginScrollView.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor].active = true;
[self.pluginScrollView.centerYAnchor constraintEqualToAnchor:self.view.centerYAnchor].active = true;
[self.pluginScrollView.topAnchor constraintGreaterThanOrEqualToAnchor:self.view.topAnchor constant:0].active = true;
[self.pluginScrollView.bottomAnchor constraintLessThanOrEqualToAnchor:self.view.bottomAnchor constant:0].active = true;

self.pluginList = [[UIStackView alloc] initWithFrame:CGRectZero];

self.tapGestures = [[NSMutableArray alloc] init];

self.pluginList.spacing = 20;
[self.pluginScrollView addSubview:self.pluginList];

[self.view addSubview:self.pluginList];

self.pluginList.translatesAutoresizingMaskIntoConstraints = NO;

self.pluginList.axis = UILayoutConstraintAxisVertical;

[self.pluginList.leadingAnchor constraintEqualToAnchor:self.pluginScrollView.leadingAnchor].active = YES;
[self.pluginList.trailingAnchor constraintEqualToAnchor:self.pluginScrollView.trailingAnchor].active = YES;
[self.pluginList.widthAnchor constraintEqualToAnchor:self.view.widthAnchor].active = YES;
[self.pluginList.topAnchor constraintEqualToAnchor:self.pluginScrollView.topAnchor constant:15].active = YES;
[self.pluginList.bottomAnchor constraintEqualToAnchor:self.pluginScrollView.bottomAnchor constant:15].active = YES;

self.view.backgroundColor = [UIColor clearColor];

[self.pluginList.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor].active = YES;
[self.pluginList.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor].active = YES;
[self.pluginList.centerYAnchor constraintEqualToAnchor:self.view.centerYAnchor].active = YES;

NSLayoutConstraint *heightContraint = [self.pluginList.heightAnchor constraintEqualToAnchor:_pluginScrollView.heightAnchor];
//This constraint will only stick around if the plugin list is not big enough to scroll
[heightContraint setPriority:250];
heightContraint.active = true;
[self loadTabs];
}

Expand Down