Home - wustZxl/Note-ios GitHub Wiki

Note

  • This is my first demo to enrich myself!
  • In this demo, I am trying to use the technologies I have learned to build a note system, in which we can quickly write down note, and to write down some upcoming tasks. And it can also remind you to do the tasks on todo lists.

iOS 13 SceneDelegate

xcode11 生命周期发生变化 参考Xcode11新变化:SceneDelegate

设置根控制器,由- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions换到了SceneDelegate的 willConnectToSession

- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
    ViewController *vc = [[ViewController alloc]init];
    UIWindowScene *windowScene = (UIWindowScene *)scene;
    self.window = [[UIWindow alloc]initWithWindowScene:windowScene];
    self.window.frame = windowScene.coordinateSpace.bounds;
    [self.window setRootViewController:vc];
    [self.window setBackgroundColor:[UIColor whiteColor]];
    [self.window makeKeyWindow];
}

如果想沿用iOS13以前的声明周期,在AppDelegate里面设置,则:

  1. 删掉“SceneDelegate.h/m”
  2. 在info.plist中找到Application Scene Manifest,删除整行配置。

UITabBar

image大小

尝试用imageInsets的方法,还是没办法改变图片大小,于是在网上找到了这种方法,done.

- (UIImage *)reSizeImage:(UIImage *)image toSize:(CGSize)reSize
{
    UIGraphicsBeginImageContext(CGSizeMake(reSize.width, reSize.height));
    [image drawInRect:CGRectMake(0, 0, reSize.width, reSize.height)];
    UIImage *reSizeImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return reSizeImage;
}

UIAlertViewController

    // get tabBarcontroller in UITabBar object.
    id delegate = [UIApplication sharedApplication].delegate; 
    UITabBarController *tabBarController = [delegate tabBarController];

    [tabBarController.selectedViewController presentViewController:alertController animated:YES completion:nil];

KVO

We cannot redefine the tabBar directly, so use KVO mechanism.

    // 利用KVO来使用自定义的tabBar
    [self setValue:[[MSCustomTabBar alloc] init] forKey:@"tabBar"];

Lottie

目前的Lottie只支持swift,需要用前面OC的历史版本。 可以用Pod安装Lottie

Masonry

  1. iOS自动布局——Masonry详解
  2. Masonry详细使用
  3. Masonry源码

Masonry安装参考文献1,基本使用参考文献1和2,

UIColor

iOS 常用RGB十六进制颜色设置的宏定义、方法

手动添加第三方framework包

  • 用源码制作库文件 product -> scheme -> edit scheme 分别换成debug和release版本在真机和模拟器上build一下,会生成四个文件:Debug-iphoneos, Debug-iphonesimulator,Release-iphoneos, Release-iphonesimulator
  • 将库文件引入到项目中
    • 在project(或者对应的Target)里,Build Settings -> Search Paths -> Framework Search Paths 四个选项都要添加对应的paths
    • 在Targrt里,Build Phases -> Link Binary With Libraries & Embed Frameworks 加入相应包
      • 将对应的包(Lottie.framework)拖到相应的目录下(Frameworks->thirdparty)
      • 找到工程目录中对应的.xcodeproj工程(WebEx.xcodeproj)显示包内容,打开project.pbxproj,找到Lottie完整的包路径,用其他配置好的framework中相应的宏来替换,保存。
      • 然后将这个包拖到 Link Binary With Libraries & Embed Frameworks 目录下。

Notification

icon