PageCaps Controller


Library Name: https://github.com/PageMenu/PageMenu

VC.h
#import <UIKit/UIKit.h>
#import "CAPSPageMenu.h"

@interface ViewController : UIViewController<CAPSPageMenuDelegate>
@property (nonatomic) CAPSPageMenu *pagemenu;

@end


VC.m


#import "ViewController.h"
#import "NewViewController.h"
#import "SecondViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self createTabs];
    
    // Do any additional setup after loading the view, typically from a nib.
}

-(void)createTabs{

    NSMutableArray *controllerArray = [NSMutableArray array];
    
    NewViewController  *ASVC = [self.storyboard instantiateViewControllerWithIdentifier:@"vc"];
    
    ASVC.title = @"Attendance Summary";
    
    [controllerArray addObject:ASVC];
    
    SecondViewController *ADVC = [self.storyboard instantiateViewControllerWithIdentifier:@"sc"];
    
    ADVC.title = @"Attendance Details";
    
    [controllerArray addObject:ADVC];
    
    self.pagemenu.delegate = self;
    
    NSDictionary *parameters = @{CAPSPageMenuOptionMenuItemSeparatorWidth: @(4.3),CAPSPageMenuOptionUseMenuLikeSegmentedControl: @(YES),
            CAPSPageMenuOptionMenuItemSeparatorPercentageHeight: @(0.1)
                                 ,CAPSPageMenuOptionViewBackgroundColor:[UIColor yellowColor],CAPSPageMenuOptionScrollMenuBackgroundColor:[UIColor redColor]
                                 };
    self.pagemenu = [[CAPSPageMenu alloc] initWithViewControllers:controllerArray frame:CGRectMake(0.0, 65,self.view.frame.size.width, self.view.frame.size.height) options:parameters];
    self.pagemenu.unselectedMenuItemLabelColor = [UIColor greenColor];
    self.pagemenu.selectedMenuItemLabelColor = [UIColor blueColor];
    self.pagemenu.viewBackgroundColor=[UIColor yellowColor];
    self.pagemenu.selectionIndicatorColor =[UIColor yellowColor];
   // self.pagemen.CAPSPageMenuOptionViewBackgroundColor=[UIColor redColor];
    [self.view addSubview:self.pagemenu.view];
    
}




@end
Previous
Next Post »