GHSidebarNav 开源项目教程

GHSidebarNav 开源项目教程

GHSidebarNavA clone of the new Facebook iOS UI paradigm项目地址:https://gitcode.com/gh_mirrors/gh/GHSidebarNav

1. 项目的目录结构及介绍

GHSidebarNav 项目的目录结构如下:

GHSidebarNav/
├── GHSidebarNav/
│   ├── AppDelegate.h
│   ├── AppDelegate.m
│   ├── MainViewController.h
│   ├── MainViewController.m
│   ├── SidebarViewController.h
│   ├── SidebarViewController.m
│   ├── main.m
│   └── Resources/
│       ├── GHRevealViewController.xib
│       └── Images.xcassets/
├── GHSidebarNavDemo/
│   ├── AppDelegate.h
│   ├── AppDelegate.m
│   ├── MainViewController.h
│   ├── MainViewController.m
│   ├── SidebarViewController.h
│   ├── SidebarViewController.m
│   ├── main.m
│   └── Resources/
│       ├── GHRevealViewController.xib
│       └── Images.xcassets/
├── LICENSE
└── README.md

目录结构介绍

  • GHSidebarNav/:包含项目的主要源代码文件和资源文件。

    • AppDelegate.hAppDelegate.m:应用程序的入口和生命周期管理。
    • MainViewController.hMainViewController.m:主视图控制器。
    • SidebarViewController.hSidebarViewController.m:侧边栏视图控制器。
    • main.m:应用程序的启动文件。
    • Resources/:包含项目的资源文件,如 XIB 文件和图片资源。
  • GHSidebarNavDemo/:包含演示项目的源代码文件和资源文件,结构与 GHSidebarNav/ 类似。

  • LICENSE:项目的许可证文件。

  • README.md:项目的说明文档。

2. 项目的启动文件介绍

项目的启动文件是 main.m,位于 GHSidebarNav/GHSidebarNavDemo/ 目录下。该文件主要负责启动应用程序,并调用 UIApplicationMain 函数来创建应用程序实例和应用程序代理。

#import <UIKit/UIKit.h>
#import "AppDelegate.h"

int main(int argc, char * argv[]) {
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

启动文件介绍

  • main.m:包含 main 函数,是应用程序的入口点。
  • UIApplicationMain 函数:创建 UIApplication 对象和应用程序代理对象,并启动应用程序的主事件循环。

3. 项目的配置文件介绍

项目的配置文件主要包括 AppDelegate.hAppDelegate.m,这两个文件位于 GHSidebarNav/GHSidebarNavDemo/ 目录下。

配置文件介绍

  • AppDelegate.h:定义了应用程序代理类的接口。
#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end
  • AppDelegate.m:实现了应用程序代理类的方法,包括应用程序启动、进入后台、进入前台等生命周期方法。
#import "AppDelegate.h"
#import "MainViewController.h"
#import "SidebarViewController.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    MainViewController *mainViewController = [[MainViewController alloc] init];
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:mainViewController];
    SidebarViewController *sidebarViewController = [[SidebarViewController alloc] init];
    GHRevealViewController *revealViewController = [[GHRevealViewController alloc] initWithNibName:@"GHRevealViewController" bundle:nil];
    revealViewController.sidebarViewController = sidebarViewController;
    revealViewController.contentViewController = navigationController;
    self.window.rootViewController = reveal

GHSidebarNavA clone of the new Facebook iOS UI paradigm项目地址:https://gitcode.com/gh_mirrors/gh/GHSidebarNav

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

舒璇辛Bertina

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值