今日学习

2017-08-02  本文已影响41人  HunterDude

二零一七年八月二十

pod install | pod update

Podfile.lock

作用:跟踪,锁定,podfile文件中依赖库的版本

第一次运行pod install命令时,会生成此文件,此文件会锁定你****此时****podfile文件中的版本。
之后每次修改podfile文件,或运行pod update命令时,会重新生成此文件。

Manifest.lock

Manifest.lock 是 Podfile.lock 的副本,每次只要生成 Podfile.lock 时就会生成一个一样的 Manifest.lock 存储在 Pods 文件夹下。在每次项目 Build 的时候,会跑一下脚本检查一下 Podfile.lock 和 Manifest.lock 是否一致。

参考:

pod install vs. pod update

关于 Podfile.lock 带来的痛


二零一七年八月十八

iOS原生与H5交互


二零一七年八月十七

iOS 中 Cocoapods 的 Bundle

cocoapods 管理图片资源和字体库

如何加载cocoapods中的资源图片?
+ (UIImage *)ht_imageNamed:(NSString *)name ofType:(nullable NSString *)type {
    NSString *mainBundlePath = [NSBundle mainBundle].bundlePath;
    NSString *bundlePath = [NSString stringWithFormat:@"%@/%@",mainBundlePath,@"SMPagerTabView.bundle"];
    NSBundle *bundle = [NSBundle bundleWithPath:bundlePath];
    if (bundle == nil) {
        bundlePath = [NSString stringWithFormat:@"%@/%@",mainBundlePath,@"Frameworks/CcfaxPagerTab.framework/SMPagerTabView.bundle"];
        bundle = [NSBundle bundleWithPath:bundlePath];
    }
    if ([UIImage respondsToSelector:@selector(imageNamed:inBundle:compatibleWithTraitCollection:)]) {
        return [UIImage imageNamed:name inBundle:bundle compatibleWithTraitCollection:nil];
    } else {
        return [UIImage imageWithContentsOfFile:[bundle pathForResource:name ofType:type]];
    }
}

    // fix:真机加载不到Bundle中资源图片。 date:20170816
    NSBundle *frameworkBundle = [NSBundle bundleForClass:self.class];
    NSURL *bundleURL = [[frameworkBundle resourceURL] URLByAppendingPathComponent:@"SMPagerTabView.bundle"];
    NSBundle *resourceBundle = [NSBundle bundleWithURL:bundleURL];
    UIImage *image = [UIImage imageNamed:@"shadowImg" inBundle:resourceBundle compatibleWithTraitCollection:nil];
    self.shadowImgView.image = image;

二零一七年八月二号

  • topLayoutGuide表示Y轴的最高点限制,表示不希望被Status Bar或Navigation Bar遮挡的视图最高位置。
  • bottomLayoutGuide表示Y轴的最低点限制,表示不希望被UITabbarController遮挡的视图最低点距离supviewlayout的距离。
  • frame就是相对于父视图的布局位置与大小:
  • bounds与frame最大的不同就是坐标系不同,bounds原点始终是(0,0),而frame的原点则不一定,而是相对于其父视图的坐标。

阅读文章:

  1. UIViewControllerUIViewController生命周期

  2. Cocoa-Swift-UIViewController布局Tips

上一篇 下一篇

猜你喜欢

热点阅读