AppDelegate中:——————
#import "AppDelegate.h"
#import "ViewController.h"
#import "RLLeftSortsViewController.h"
#import "RLLeftSlideViewController.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
? ? ViewController *mainVC = [[ViewController alloc]init];
? ? RLLeftSortsViewController *LeftVC = [[RLLeftSortsViewController alloc]init];
? ? RLLeftSlideViewController *rootVC = [[RLLeftSlideViewController alloc]initWithLeftView:LeftVC andMainView:mainVC];
? ? self.window.rootViewController = rootVC;
? ? return YES;
}
ViewController中————————
#import "ViewController.h"
#import "PDBannerView.h"
#import "FirstView.h"
#import "SecondView.h"
#import "PDLinkageView.h"
@interface ViewController ()
{
? ? NSArray*arr;
}
@end
@implementation ViewController
- (void)viewDidLoad {
? ? [super viewDidLoad];
? ? arr = @[@"1",@"2",@"3"];
? ? PDBannerView*pd = [[PDBannerViewalloc]initWithFrame:CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.height)andImageArray:(NSMutableArray*)arr];
? ? [self.viewaddSubview:pd];
? ? dispatch_after(dispatch_time(DISPATCH_TIME_NOW /** 從什么時間開始 */, (int64_t)(6.0 /** 延時幾秒 */ * NSEC_PER_SEC)), dispatch_get_main_queue() /** 在哪一個線程中執(zhí)行 */, ^
? ? {
? ? ? ? [pdremoveFromSuperview];
? ? });
? ? FirstView*first = [[FirstViewalloc]init];
? ? SecondView *sec = [[SecondView alloc]init];
? ? first.title=@"首頁";
? ? sec.title=@"個人";
? ? UINavigationController *firstNav = [[UINavigationController alloc]initWithRootViewController:first];
? ? UINavigationController *secNav = [[UINavigationController alloc]initWithRootViewController:sec];
? ? self.viewControllers=@[firstNav,secNav];
}
第一個視圖中——————
#import "FirstView.h"
#import "PDLinkageView.h"
@interface FirstView ()
@end
@implementation FirstView
- (void)viewDidLoad {
? ? [super viewDidLoad];
? ? self.view.backgroundColor = [UIColor yellowColor];
? ? NSArray*titleArr =@[@"第一頁",@"第二頁",@"第三頁"];
? ? PDLinkageView *link = [[PDLinkageView alloc]initWithFrame:CGRectMake(0, 64, self.view.frame.size.width, 500) viewController:self titleArray:titleArr defaultButtonIndex:0];
? ? [self.viewaddSubview:link];
}