JTAlertView 开源项目教程
1. 项目的目录结构及介绍
JTAlertView 项目的目录结构如下:
JTAlertView/
├── JTAlertView/
│ ├── JTAlertView.h
│ ├── JTAlertView.m
│ ├── JTAlertViewButton.h
│ ├── JTAlertViewButton.m
│ ├── JTAlertViewShadowView.h
│ ├── JTAlertViewShadowView.m
│ ├── JTAlertViewShapeLayer.h
│ ├── JTAlertViewShapeLayer.m
│ ├── JTAlertViewStack.h
│ ├── JTAlertViewStack.m
│ ├── JTAlertViewTextField.h
│ ├── JTAlertViewTextField.m
│ ├── JTAlertViewView.h
│ └── JTAlertViewView.m
├── JTAlertViewDemo/
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ ├── Base.lproj
│ ├── Info.plist
│ ├── Main.storyboard
│ ├── ViewController.h
│ └── ViewController.m
├── JTAlertView.xcodeproj
└── README.md
目录结构介绍
-
JTAlertView/
:包含 JTAlertView 的核心代码文件。JTAlertView.h
和JTAlertView.m
:JTAlertView 的主类文件。JTAlertViewButton.h
和JTAlertViewButton.m
:自定义按钮类文件。JTAlertViewShadowView.h
和JTAlertViewShadowView.m
:阴影视图类文件。JTAlertViewShapeLayer.h
和JTAlertViewShapeLayer.m
:形状图层类文件。JTAlertViewStack.h
和JTAlertViewStack.m
:堆栈管理类文件。JTAlertViewTextField.h
和JTAlertViewTextField.m
:自定义文本框类文件。JTAlertViewView.h
和JTAlertViewView.m
:自定义视图类文件。
-
JTAlertViewDemo/
:包含 JTAlertView 的演示项目文件。AppDelegate.h
和AppDelegate.m
:应用程序委托文件。Assets.xcassets
:资源文件夹。Base.lproj
:本地化文件夹。Info.plist
:项目配置文件。Main.storyboard
:主故事板文件。ViewController.h
和ViewController.m
:视图控制器文件。
-
JTAlertView.xcodeproj
:Xcode 项目文件。 -
README.md
:项目说明文件。
2. 项目的启动文件介绍
JTAlertView 项目的启动文件是 AppDelegate.m
。该文件负责应用程序的生命周期管理,包括应用程序启动、进入后台、返回前台等事件的处理。
#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the active state; here you can undo many