36day 新浪微博(CELL时间 来源)
来源:互联网 发布:手机淘宝5.2.8版本 编辑:程序博客网 时间:2024/06/05 18:47
HWStatuePhotosView
1、#pragma mark - 根据图片个数计算 控件的size
#pragma mark - 根据图片个数计算size/** 计算列数、行数,来确定相册的大小*/- (CGSize)sizeWithPicUrlsCount:(long)count{ long maxCols = HWStatuesPhotoMaxClos(count); CGFloat wh = HWStatuesPhotoWH(maxCols); //列数 long cols = (count>=maxCols) ? maxCols : count; CGFloat photoW = cols*wh +(cols-1)*HWStatuesPhotoMargin; //行数 long rows = (count+maxCols-1)/maxCols;//此公式也适用于分页的页数计算 CGFloat photoH = rows*wh +(rows-1)*HWStatuesPhotoMargin; return CGSizeMake(photoW, photoH);}
判断字符串是否以什么结尾
- (BOOL)isGifImage:(NSString *)url{ /**方法一 */// NSRange range= [url rangeOfString:@".gif"];// return !(range.length == 0 || range.location == NSNotFound); /** 方法二*/ return [url hasSuffix:@".gif"];}
3、图片的内容模式
/**UIViewContentModeScaleToFill, 拉伸填充整个UIImageView(可能会变形) UIViewContentModeScaleAspectFit, // contents scaled to fit with fixed aspect. remainder is transparent 按照原来尺寸继续伸缩填充整个UIImageView(不会变形,上下或者左右可能会出现空白部分) UIViewContentModeScaleAspectFill, // contents scaled to fill with fixed aspect. some portion of content may be clipped. 按照原来的尺寸进行拉伸填充,但会超出frame。配合属性使用clipsToBounds 进行裁剪(内容会展示不全) 拉伸到高度(W)与UIImageView的高度(W)一样,就停止拉伸。再居中显示-》部分超出frame UIViewContentModeRedraw, // redraw on bounds change (calls -setNeedsDisplay) UIViewContentModeCenter, // contents remain same size. positioned adjusted. UIViewContentModeTop, UIViewContentModeBottom, UIViewContentModeLeft, UIViewContentModeRight, UIViewContentModeTopLeft, UIViewContentModeTopRight, UIViewContentModeBottomLeft, UIViewContentModeBottomRight, 规律: 1.凡是带有Scale单词的模式,图片都会拉伸 2.凡是带有Aspect单词的模式,图片都会保持图片原来的宽高比(图片不会变形) */ self.contentMode = UIViewContentModeScaleAspectFill; self.clipsToBounds = YES;//Setting this value to YES causes subviews to be clipped to the bounds of the receiver.
block定义使用,对外部变量引用的规则
/** 知识点: 1>block会在定义那一刻,直接拿到外部的局部变量task的值。以后block中局部变量task的值就固定不变 2>block中 对被————block修饰的变量的一直引用*/ __block UIBackgroundTaskIdentifier task = [application beginBackgroundTaskWithExpirationHandler:^{ // 当申请的后台运行时间已经结束(过期),就会调用这个block // 赶紧结束任务 [application endBackgroundTask:task]; }];
阅读全文
0 0
- 36day 新浪微博(CELL时间 来源)
- 35day 新浪微博(CELL转发)
- 34day 新浪微博(首页)
- 新浪微博如何自定义来源尾巴
- 一、30day- 新浪微博(框架)
- 二、31day 新浪微博(顶部)
- 32day 新浪微博(授权 新特性)
- 自定义cell的高度(新浪微博)
- 30day-40day 新浪微博(项目实践)
- 类似新浪微博来源显示-来自ipone手机
- 猫猫学IOS(十七)UI之纯代码自定义Cell实现新浪微博UI
- AJ学IOS(17)UI之纯代码自定义Cell实现新浪微博UI
- 33day 新浪微博(获取用户微博数据)
- 新浪 Cell
- 通过代码自定义cell(cell的高度不一致)实现新浪微博界面
- web前端-获取用户的来源是否为新浪微博
- Python模拟新浪微博登录转载,是我的那篇资料来源
- 新浪微博API 时间转化
- 欧几里得求最大公约数
- 暑期ssh框架spring学习笔记一
- JQ文字向上轮播
- spring boot遇到的异常1
- Manifest合并失败几种原因以及解决方法
- 36day 新浪微博(CELL时间 来源)
- java高并发的解决方案
- 闪屏页实现
- Map转bean多类型转换,bean转map
- python中的@property(get与set作用
- systemd-logind导致ssh登录缓慢解决办法
- python爬虫遇到换行
- 文件编译初学习
- javascript 字符串