ios学习记录

git 上 clone 下来 pod install 出错

使用 pod update --verbose

输入框光标的颜色
[[UITextField appearance] setTintColor:[UIColor blackColor]];

下拉上部 frame 改变

  • (void)scrollViewDidScroll:(UIScrollView *)scrollView{
    CGPoint offst = scrollView.contentOffset;
    CGFloat width = self.view.bounds.size.width;
    CGFloat height = self.view.bounds.size.height;
    self.scrollView.frame = CGRectMake(0, offst.y, width, height);
    if (offst.y <= -64.000000) {
    self.imageView = self.scrollView.subviews[0];
    CGRect newFrame = self.imageView.frame;
    CGFloat difference = (self.top - offst.y) / 3;
    newFrame.origin.x -= difference;
    newFrame.origin.y -= difference;
    newFrame.size.height += difference * 2.563;
    newFrame.size.width += difference * 2;
    self.imageView.frame = newFrame;
    self.top = offst.y;
    }
    }
  • (CGFloat)cellHeight:(NSString *)content {
    /字符串类目方法,计算高度/
    CGRect rect = [content boundingRectWithSize:CGSizeMake([UIScreen mainScreen].bounds.size.width / 2, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:17.0f]} context:nil];
    return rect.size.height + 41;
    }

  • (CGFloat)cellHeight:(NSString *)imageName {
    /根据UIImage的size属性, 计算高度/
    UIImage *image = [UIImage imageNamed:imageName];
    return [UIScreen mainScreen].bounds.size.width * image.size.height / image.size.width;
    }

中文 转 NSString
http://nshipster.cn/cfstringtransform/

iOS xcode 注释

//TODO: -----------
//FIXME: ----------
//MARK: -----------

iOS NSURLCache

缓存策略 CachePolicy 存储到 Cache
POST 不可缓存

self.view endEditing:YES

URL uniform resource locator
协议://主机地址/路径

UIButton

{
括号内设置 为实例变量
}
@property 此为属性 属性比实例变量多 setter getter 方法 当有有例外

UIButton.textLabel 为实例变量
所以 UIButton.textLabel.text = @“” 这样会造成赋值失败
系统有自带的 setter方法 setTitle ………….

//居中

label.center = CGPointMake(CGRectGetMidX(view.bounds), CGRectGetMidY(view.bounds));

// 这两个方法又什么区别
NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:15];

NSURLRequest *request = [NSURLRequest requestWithURL:url];

你可能感兴趣的:(iOS)