240 发简信
IP属地:云南
  • 博主的代码不够精炼,应该这样写:

    ```
    NSDictionary *views = @{@"title":self.titleLabel, @"lamp":self.lampView, @"con":self.controlView, @"follow": followButton, @"music": music};

    [views enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) {
    [(UIView *)obj setTranslatesAutoresizingMaskIntoConstraints:false];
    }];

    [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[title]|" options:0 metrics:nil views:views]];

    [[NSLayoutConstraint constraintWithItem:followButton attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.headImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0] setActive:true];
    ```

    iOS使用代码进行AutoLayout自动布局

    1.简介 1.在以前的iOS代码中是如何设置布局UI界面的?经常编写大量的坐标计算代码,为了保证在3.5 inch和4.0 inch屏幕上都能有完美的UI界面效果,有时还需要...

  • 楼主的教程还不能支持后台下载,需要再设置backgroundconfig的一个属性:

    config.sessionSendsLaunchEvents = true

    这样才能实现后台任务。

    iOS使用NSURLSession进行下载(包括后台下载,断点下载)

    从iOS7以来,苹果推出NSURLSession后,iOS现在可以实现真正的后台下载,这对我们iOSer来说是一个福音。 一个 NSURLSession对象可以协调一个或多个...

  • 打造自己的 WebView Shell

    github wiki: https://github.com/0xfeedface1993/WebShell/wiki

  • UIView-Encapsulated-Layout-Height 这个错误 大部分是没有 updateConstraintsIfNeeded

    UITableViewCell LayoutConstraint (UIView-Encapsulated-Layout-Height)

    iOS的LayoutConstraint总会莫名出现很多很奇怪的警告,虽然它不影响工程的正常运行,但是每每看到终端输出一大堆的警告提示,对于我们这些有洁癖的人,怎么能够容忍。...

  • iOS初学者?

    swift 中tableview 的使用方法

    在 swift 中 tableview 的实现步骤 如下: 第一步: 先写tableview两个代理 UITableViewDataSource 和 UITableViewD...