123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- //
- // MASExampleListViewController.h
- // Masonry
- //
- // Created by Jonas Budelmann on 21/07/13.
- // Copyright (c) 2013 cloudling. All rights reserved.
- //
- #import "MASExampleListViewController.h"
- #import "MASExampleViewController.h"
- #import "MASExampleBasicView.h"
- #import "MASExampleConstantsView.h"
- #import "MASExampleSidesView.h"
- #import "MASExampleAnimatedView.h"
- #import "MASExampleDebuggingView.h"
- #import "MASExampleLabelView.h"
- #import "MASExampleUpdateView.h"
- #import "MASExampleScrollView.h"
- #import "MASExampleLayoutGuideViewController.h"
- static NSString * const kMASCellReuseIdentifier = @"kMASCellReuseIdentifier";
- @interface MASExampleListViewController ()
- @property (nonatomic, strong) NSArray *exampleControllers;
- @end
- @implementation MASExampleListViewController
- - (id)init {
- self = [super init];
- if (!self) return nil;
-
- self.title = @"Examples";
-
- self.exampleControllers = @[
- [[MASExampleViewController alloc] initWithTitle:@"Basic"
- viewClass:MASExampleBasicView.class],
- [[MASExampleViewController alloc] initWithTitle:@"Update Constraints"
- viewClass:MASExampleUpdateView.class],
- [[MASExampleViewController alloc] initWithTitle:@"Using Constants"
- viewClass:MASExampleConstantsView.class],
- [[MASExampleViewController alloc] initWithTitle:@"Composite Edges"
- viewClass:MASExampleSidesView.class],
- [[MASExampleViewController alloc] initWithTitle:@"Basic Animated"
- viewClass:MASExampleAnimatedView.class],
- [[MASExampleViewController alloc] initWithTitle:@"Debugging Helpers"
- viewClass:MASExampleDebuggingView.class],
- [[MASExampleViewController alloc] initWithTitle:@"Bacony Labels"
- viewClass:MASExampleLabelView.class],
- [[MASExampleViewController alloc] initWithTitle:@"UIScrollView"
- viewClass:MASExampleScrollView.class],
- [[MASExampleLayoutGuideViewController alloc] init],
- ];
-
- return self;
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.view.backgroundColor = [UIColor whiteColor];
- [self.tableView registerClass:UITableViewCell.class forCellReuseIdentifier:kMASCellReuseIdentifier];
- }
- #pragma mark - UITableViewDataSource
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- UIViewController *viewController = self.exampleControllers[indexPath.row];
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kMASCellReuseIdentifier forIndexPath:indexPath];
- cell.textLabel.text = viewController.title;
- return cell;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return self.exampleControllers.count;
- }
- #pragma mark - UITableViewDelegate
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- UIViewController *viewController = self.exampleControllers[indexPath.row];
- [self.navigationController pushViewController:viewController animated:YES];
- }
- @end
|