码迷,mamicode.com
首页 > 其他好文 > 详细

QQ空间客户端(4)-设置左侧菜单栏属性

时间:2016-12-22 22:48:50      阅读:213      评论:0      收藏:0      [点我收藏+]

标签:int   ima   atom   time   add   技术   ceo   const   created   

DJHomeViewController.m

#import "DJHomeViewController.h"
#import "DJMenuView.h"


const CGFloat screenW = 768;
const CGFloat screenH = 1024;

@interface DJHomeViewController ()

@property (nonatomic,weak) DJMenuView *menuView;

@end

@implementation DJHomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    DJMenuView *menuView = [[DJMenuView alloc] init];
    
    [self.view addSubview:menuView];
    self.menuView = menuView;
    
    // 根据屏幕方向设置menu属性
    [self willRotateToInterfaceOrientation:self.interfaceOrientation duration:0];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


/** 当屏幕方向将会发生改变时调用此方法 */
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {

    if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) {
        NSLog(@"当前已旋转为横屏");
        self.menuView.width = 150;
        self.menuView.height = screenW;
        
    } else {
        NSLog(@"当前已旋转为竖屏");
        self.menuView.width = 80;
        self.menuView.height = screenH;
    }

}


@end

横屏:

技术分享

竖屏:

技术分享

 

QQ空间客户端(4)-设置左侧菜单栏属性

标签:int   ima   atom   time   add   技术   ceo   const   created   

原文地址:http://www.cnblogs.com/yongdaimi/p/6213097.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!