【iOS】那些年源码中的Tips...

  1. RESideMenu-> UIInterpolatingMotionEffect->视觉差效果(iOS7)
  2. RESideMenu-> 制作类似UINavigationController、UITabBarController的控制器容器

RESideMenu

  1. 视觉差效果
    UIInterpolatingMotionEffect这个东西其实是iOS7的,原谅我现在才知道。。。效果就是在真机(模拟器没有传感器)上面左右或者上下倾斜手机,view会自动根据感应器的倾斜角度对View进行偏移 给人以视觉上的层次感(iOS系统桌面背景图)
    keyPath:左右翻转屏幕将要影响到的属性,比如center.x。
    type:(UIInterpolatingMotionEffectType类型),观察者视角,也就是屏幕倾斜的方式,目前区分水平和垂直两种方式
    minimumRelativeValue、maximumRelativeValuev 对应的值的变化范围,注意这个是id类型。min对应最小的offset,max对应最大的offset。视差的范围
//最好每次添加效果的时候先移除掉原来的那些效果
for (UIMotionEffect *effect in self.menuViewContainer.motionEffects) {
             [self.menuViewContainer removeMotionEffect:effect];
         }
UIInterpolatingMotionEffect *interpolationHorizontal = [[UIInterpolatingMotionEffect alloc]initWithKeyPath:@"center.x" type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis];
interpolationHorizontal.minimumRelativeValue = @(self.parallaxMenuMinimumRelativeValue);
interpolationHorizontal.maximumRelativeValue = @(self.parallaxMenuMaximumRelativeValue);
         
UIInterpolatingMotionEffect *interpolationVertical = [[UIInterpolatingMotionEffect alloc]initWithKeyPath:@"center.y" type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis];
interpolationVertical.minimumRelativeValue = @(self.parallaxMenuMinimumRelativeValue);
interpolationVertical.maximumRelativeValue = @(self.parallaxMenuMaximumRelativeValue);
//这玩意一般最好加到背景图(ios系统桌面的背景图)给人以层次感
[self.menuViewContainer addMotionEffect:interpolationHorizontal];
[self.menuViewContainer addMotionEffect:interpolationVertical];
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 内容抽屉菜单ListViewWebViewSwitchButton按钮点赞按钮进度条TabLayout图标下拉刷新...
    皇小弟阅读 46,945评论 22 665
  • 过年这段时间在家里跟爸妈亲人聊天唠嗑的时间居多,渐渐的疏远了手机,落下了许多朋友圈的东西。 终于在完成了每年过年必...
    梅桥南四三阅读 458评论 1 1
  • 你在干嘛呀 昨天晚上梦到你了喔 你带我去吃了那家我一直想吃的小火锅 雾气腾腾里你红着脸跟我说 “慢点吃 小心烫” ...
    秦二佛爷阅读 238评论 0 0
  • 今天的事实在太逗,得写出来以后可以回味。提醒一下观看的各位帅哥美女们。下面的文字可能涉及18岁以上的东西,请想清...
    承思而行阅读 138评论 0 1
  • 滴答滴答,一个个番茄不知不觉被吃掉,又完成了清单上一项任务,很有成就感。最近在学习使用番茄工作法,简单易上手的...
    hxleihao阅读 498评论 0 0