本文主要是介绍开源中国社区iOS客户端学习-(1)侧拉栏的实现,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
作为一个没有工作的iOS菜鸟,我很为如何进步到可以找一份工作的水平而发愁。幸好现在有很多开源的iOS资源。
开源中国客户端代码下载地址
更多的开源iOS资源
打开客户端,点击左上角的按钮,界面的变成了这样
很好奇这个神奇的效果是如何实现的。
打开工程文件夹中的Podfile,可以查看这个App使用的第三方库。其中,RESideMenu就是用来实现侧拉栏的。
RESideMenu有两种使用方法,一种单纯使用代码,第二种结合storyboard。我在AppDelegate.m中并没有看到相关初始化的方法,很明显,为了少些几行代码, 他们用了第二种方法。
在RootViewController.h中
#import "RESideMenu.h"@interface RootViewController : RESideMenu
在RootViewController.m中
- (void)awakeFromNib
{self.parallaxEnabled = NO;self.scaleContentView = YES;self.contentViewScaleValue = 0.95;self.scaleMenuView = NO;self.contentViewShadowEnabled = YES;self.contentViewShadowRadius = 4.5;self.contentViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"contentViewController"];self.leftMenuViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"leftMenuViewController"];
}
最后,再将storyboard中的button与UIViewController+RESideMenu.h中的
- (IBAction)presentLeftMenuViewController:(id)sender;
//或
- (IBAction)presentRightMenuViewController:(id)sender;
关联。
这篇关于开源中国社区iOS客户端学习-(1)侧拉栏的实现的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!