美文网首页
仿QQ抽屉左侧滑动效果

仿QQ抽屉左侧滑动效果

作者: 芯辰0312 | 来源:发表于2018-07-30 07:55 被阅读0次

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() /** 在哪一个线程中执行 */, ^

    {

        [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];

}

相关文章

网友评论

      本文标题:仿QQ抽屉左侧滑动效果

      本文链接:https://www.haomeiwen.com/subject/vuzgmftx.html