首页 > 代码库 > QQ空间客户端(4)-设置左侧菜单栏属性
QQ空间客户端(4)-设置左侧菜单栏属性
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)-设置左侧菜单栏属性
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。