Commit faa497b2 authored by Sandy's avatar Sandy

评论添加图片

parent f54c92a9
...@@ -7,7 +7,10 @@ ...@@ -7,7 +7,10 @@
// //
#import "CommentListTableViewCell.h" #import "CommentListTableViewCell.h"
#import "MWPhotoBrowser.h"
@interface CommentListTableViewCell ()<MWPhotoBrowserDelegate>
@property (nonatomic,strong) NSMutableArray *browserArray;
@end
@implementation CommentListTableViewCell @implementation CommentListTableViewCell
- (void)awakeFromNib { - (void)awakeFromNib {
...@@ -23,6 +26,7 @@ ...@@ -23,6 +26,7 @@
for (UIImageView *obj in self.attachmentView.subviews) { for (UIImageView *obj in self.attachmentView.subviews) {
if ([obj isKindOfClass:[UIImageView class]]) { if ([obj isKindOfClass:[UIImageView class]]) {
obj.userInteractionEnabled = YES;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImage:)]; UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImage:)];
[obj addGestureRecognizer:tap]; [obj addGestureRecognizer:tap];
} }
...@@ -30,7 +34,38 @@ ...@@ -30,7 +34,38 @@
} }
- (void)tapImage:(UIGestureRecognizer *)tap { - (void)tapImage:(UIGestureRecognizer *)tap {
NSLog(@"%lu", tap.view.tag); if (tap.view.tag + 1 > self.replyEntity.attachments.count) {
return;
}
[self.browserArray removeAllObjects];
for (TOAttachmentEntity *att in self.replyEntity.attachments) {
MWPhoto *photo = [MWPhoto photoWithURL:[NSURL URLWithString:att.fileUrl]];
[self.browserArray addObject:photo];
}
MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
[browser setCurrentPhotoIndex:tap.view.tag];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:browser];
[self.viewController.navigationController presentViewController:nav animated:YES completion:nil];
}
#pragma mark - <MWPhotoBrowserDelegate>
- (NSUInteger)numberOfPhotosInPhotoBrowser:(MWPhotoBrowser *)photoBrowser
{
return self.browserArray.count;
}
- (id<MWPhoto>)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index
{
if (index < self.browserArray.count) {
return [self.browserArray objectAtIndex:index];
}
return nil;
}
- (NSString *)photoBrowser:(MWPhotoBrowser *)photoBrowser titleForPhotoAtIndex:(NSUInteger)index
{
return [NSString stringWithFormat:@"%ld/%ld", index + 1, self.browserArray.count];
} }
#pragma mark - 选项按钮 #pragma mark - 选项按钮
- (IBAction)extensionButtonClickAction:(UIButton *)sender { - (IBAction)extensionButtonClickAction:(UIButton *)sender {
...@@ -59,6 +94,26 @@ ...@@ -59,6 +94,26 @@
self.bestView.isBest = _replyEntity.best; self.bestView.isBest = _replyEntity.best;
self.bestView.indexPath = self.indexPath; self.bestView.indexPath = self.indexPath;
self.baseImageView.hidden = !_replyEntity.best; self.baseImageView.hidden = !_replyEntity.best;
if (replyEntity.attachments.count > 0) {
self.layoutAttHeight.constant = 164;
}else{
self.layoutAttHeight.constant = 0;
}
for (NSInteger i = 0; i < replyEntity.attachments.count; i++) {
TOAttachmentEntity *att = replyEntity.attachments[i];
UIImageView *imgView = (UIImageView *)[self.attachmentView viewWithTag:i];
[imgView sd_setImageWithURL:[NSURL URLWithString:att.fileUrl] placeholderImage:REPLACEIMAGE];
}
}
#pragma mark - lazy
- (NSMutableArray *)browserArray
{
if (!_browserArray) {
_browserArray = [NSMutableArray array];
}
return _browserArray;
} }
@end @end
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#import "ZJKeyBoardAccessoryView.h" #import "ZJKeyBoardAccessoryView.h"
#import "ForumDetailBottomView.h" #import "ForumDetailBottomView.h"
#import "OSSHelper.h" #import "OSSHelper.h"
#import "ForumCommentListViewModel.h"
#import "UIImage+Helper.h"
@interface ForumItemDetailViewController ()<UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate,TapClickDelegate,ReturnTableviewcellIndexpathdelegate> @interface ForumItemDetailViewController ()<UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate,TapClickDelegate,ReturnTableviewcellIndexpathdelegate>
...@@ -170,7 +172,12 @@ ...@@ -170,7 +172,12 @@
weakSelf.commentsArray = nil; weakSelf.commentsArray = nil;
} }
weakSelf.topicReply = [[ForumReplyResponse alloc] initWithDictionary:RESPONSE(returnValue) error:nil]; weakSelf.topicReply = [[ForumReplyResponse alloc] initWithDictionary:RESPONSE(returnValue) error:nil];
[weakSelf.commentsArray addObjectsFromArray:weakSelf.topicReply.forumReplyEntity]; for (CustomTOForumReplyEntity *entity in weakSelf.topicReply.forumReplyEntity) {
ForumCommentListViewModel *model = [ForumCommentListViewModel new];
model.replyEntity = entity;
[weakSelf.commentsArray addObject:model];
}
[weakSelf setUpCommentNumber]; [weakSelf setUpCommentNumber];
[weakSelf.forumDetailTableView reloadData]; [weakSelf.forumDetailTableView reloadData];
}else { }else {
...@@ -230,7 +237,8 @@ ...@@ -230,7 +237,8 @@
CommentListTableViewCell *commentCell = [tableView dequeueReusableCellWithIdentifier:@"CommentListTableViewCell" forIndexPath:indexPath]; CommentListTableViewCell *commentCell = [tableView dequeueReusableCellWithIdentifier:@"CommentListTableViewCell" forIndexPath:indexPath];
commentCell.bestView.delegate = self; commentCell.bestView.delegate = self;
commentCell.indexPath = indexPath; commentCell.indexPath = indexPath;
commentCell.replyEntity = self.commentsArray[indexPath.row]; ForumCommentListViewModel *cellModel = self.commentsArray[indexPath.row];
commentCell.replyEntity = cellModel.replyEntity;
BOOL boolValue = ([self.topicDetail.posterId isEqualToString:[Shoppersmanager manager].shoppers.employee.fid] && [self.category.name isEqualToString:OPPLE_ASK]); BOOL boolValue = ([self.topicDetail.posterId isEqualToString:[Shoppersmanager manager].shoppers.employee.fid] && [self.category.name isEqualToString:OPPLE_ASK]);
commentCell.optionButton.hidden = !boolValue; commentCell.optionButton.hidden = !boolValue;
return commentCell; return commentCell;
...@@ -256,9 +264,9 @@ ...@@ -256,9 +264,9 @@
} }
break; break;
} }
CustomTOForumReplyEntity *replyEntity = self.commentsArray[indexPath.row]; ForumCommentListViewModel *cellModel = self.commentsArray[indexPath.row];
//68为上边距 10为下边距 //68为上边距 10为下边距
return replyEntity.replyContentHeight + 68 + 10; return cellModel.height;
} }
- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
...@@ -309,10 +317,13 @@ ...@@ -309,10 +317,13 @@
#pragma mark - 上传图片附件 #pragma mark - 上传图片附件
- (void)uploadAttachments:(void(^)(NSArray *OSSKeys))finish - (void)uploadAttachments:(void(^)(NSArray *OSSKeys))finish
{ {
if (self.bottomView.toolView.arrSelectedPhotos.count == 0) {
finish(nil);
return;
}
NSMutableArray *OSSKeyArray = [NSMutableArray array]; NSMutableArray *OSSKeyArray = [NSMutableArray array];
for (int i=0; i<self.bottomView.toolView.arrSelectedPhotos.count; i++) { for (int i=0; i<self.bottomView.toolView.arrSelectedPhotos.count; i++) {
[OSSKeyArray addObject:[OSSHelper getOSSObjectKeyWithtype:@"png" index:i]]; [OSSKeyArray addObject:[OSSHelper getOSSObjectKeyWithtype:@"jpg" index:i]];
} }
XBLoadingView *loadView = [XBLoadingView showHUDViewProgressLabel:[NSString stringWithFormat:@"图片上传中:1/%ld",self.bottomView.toolView.arrSelectedPhotos.count]]; XBLoadingView *loadView = [XBLoadingView showHUDViewProgressLabel:[NSString stringWithFormat:@"图片上传中:1/%ld",self.bottomView.toolView.arrSelectedPhotos.count]];
static NSInteger number = 0; static NSInteger number = 0;
...@@ -321,7 +332,8 @@ ...@@ -321,7 +332,8 @@
for (int i=0;i<self.bottomView.toolView.arrSelectedPhotos.count;i++) { for (int i=0;i<self.bottomView.toolView.arrSelectedPhotos.count;i++) {
UIImage *image = self.bottomView.toolView.arrSelectedPhotos[i]; UIImage *image = self.bottomView.toolView.arrSelectedPhotos[i];
NSString *ossKey = OSSKeyArray[i]; NSString *ossKey = OSSKeyArray[i];
NSData *data = UIImagePNGRepresentation(image); UIImage *newSizeImage = [image scaledToWidth:1024];
NSData *data = [newSizeImage scaledToSpaceMaxSize:200];
[OSSHelper uploadImageObjectWithKey:ossKey data:data type:OSSHelperOperationTypeSynchronous progress:^(int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend) { [OSSHelper uploadImageObjectWithKey:ossKey data:data type:OSSHelperOperationTypeSynchronous progress:^(int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend) {
CGFloat totalBytesSentFloat = totalBytesSent; CGFloat totalBytesSentFloat = totalBytesSent;
CGFloat totalBytesExpectedToSendFloat = totalBytesExpectedToSend; CGFloat totalBytesExpectedToSendFloat = totalBytesExpectedToSend;
...@@ -394,6 +406,7 @@ ...@@ -394,6 +406,7 @@
[XBLoadingView hideHUDViewWithDefault]; [XBLoadingView hideHUDViewWithDefault];
if (RESULT(returnValue)) { if (RESULT(returnValue)) {
weakSelf.commentInputTextFieldView.text = nil; weakSelf.commentInputTextFieldView.text = nil;
[weakSelf.bottomView clearPhoto];
[XBLoadingView showHUDViewWithSuccessText:@"评论成功" completeBlock:^{ [XBLoadingView showHUDViewWithSuccessText:@"评论成功" completeBlock:^{
if (weakSelf.refreshBlock) { if (weakSelf.refreshBlock) {
weakSelf.refreshBlock(ONE,Comment,weakSelf.indexPath); weakSelf.refreshBlock(ONE,Comment,weakSelf.indexPath);
......
//
// ForumCommentListViewModel.h
// Lighting
//
// Created by Javen on 2017/4/18.
// Copyright © 2017年 上海勾芒科技有限公司. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ForumCommentListViewModel : NSObject
/**
回复数据源
*/
@property (nonatomic,strong) CustomTOForumReplyEntity *replyEntity;
@property (nonatomic, assign) CGFloat height;
@end
//
// ForumCommentListViewModel.m
// Lighting
//
// Created by Javen on 2017/4/18.
// Copyright © 2017年 上海勾芒科技有限公司. All rights reserved.
//
#import "ForumCommentListViewModel.h"
static UILabel *stringLabel = nil;
@implementation ForumCommentListViewModel
- (void)setReplyEntity:(CustomTOForumReplyEntity *)replyEntity {
_replyEntity = replyEntity;
self.height = 88;
if (replyEntity.attachments.count > 0) {
self.height = 88 + 164;
}
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{ //生成一个用于计算文本高度的label
stringLabel = [[UILabel alloc] init];
stringLabel.font = [UIFont systemFontOfSize:17];
stringLabel.numberOfLines = 0;
});
stringLabel.text = replyEntity.replyContent;
self.height = self.height + [stringLabel sizeThatFits:CGSizeMake(ScreenWidth - 40, MAXFLOAT)].height + 16;
NSLog(@"%f", self.height);
}
@end
...@@ -16,4 +16,6 @@ ...@@ -16,4 +16,6 @@
*/ */
@property (strong, nonatomic) ZJKeyBoardAccessoryView *toolView; @property (strong, nonatomic) ZJKeyBoardAccessoryView *toolView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layoutHeight; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *layoutHeight;
- (void)clearPhoto;
@end @end
...@@ -54,6 +54,10 @@ ...@@ -54,6 +54,10 @@
return cell; return cell;
} }
- (void)clearPhoto {
[self.toolView deleteAll];
}
/* /*
// Only override drawRect: if you perform custom drawing. // Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation. // An empty implementation adversely affects performance during animation.
......
...@@ -13,5 +13,15 @@ ...@@ -13,5 +13,15 @@
@property (strong, nonatomic) NSMutableArray *arrSelectedPhotos; @property (strong, nonatomic) NSMutableArray *arrSelectedPhotos;
@property (nonatomic, copy) void (^blockFinishSelected)(void); @property (nonatomic, copy) void (^blockFinishSelected)(void);
/**
删除指定下标的图片
@param index 下标
*/
- (void)deletePhotoWithIndex:(NSInteger)index; - (void)deletePhotoWithIndex:(NSInteger)index;
/**
删除所有的图片
*/
- (void)deleteAll;
@end @end
...@@ -28,7 +28,7 @@ typedef NS_ENUM(NSInteger, ItemIndex) { ...@@ -28,7 +28,7 @@ typedef NS_ENUM(NSInteger, ItemIndex) {
@property (strong, nonatomic) NSMutableArray *allPhotoArray; @property (strong, nonatomic) NSMutableArray *allPhotoArray;
/** /**
<#Description#>
*/ */
@property (strong, nonatomic) NSMutableArray *mwPhotoArray; @property (strong, nonatomic) NSMutableArray *mwPhotoArray;
...@@ -36,6 +36,7 @@ typedef NS_ENUM(NSInteger, ItemIndex) { ...@@ -36,6 +36,7 @@ typedef NS_ENUM(NSInteger, ItemIndex) {
缩略图 缩略图
*/ */
@property (strong, nonatomic) NSMutableArray *thumbsArray; @property (strong, nonatomic) NSMutableArray *thumbsArray;
@property (strong, nonatomic) NSMutableDictionary *cache;
@end @end
@implementation ZJKeyBoardAccessoryView @implementation ZJKeyBoardAccessoryView
...@@ -100,10 +101,14 @@ typedef NS_ENUM(NSInteger, ItemIndex) { ...@@ -100,10 +101,14 @@ typedef NS_ENUM(NSInteger, ItemIndex) {
#pragma mark - <UIImagePickerControllerDelegate> #pragma mark - <UIImagePickerControllerDelegate>
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *, id> *)info { - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *, id> *)info {
// [self.navigationController dismissViewControllerAnimated:YES completion:nil]; [picker dismissViewControllerAnimated:YES completion:nil];
UIImage *headImage = [info objectForKey:UIImagePickerControllerOriginalImage]; UIImage *headImage = [info objectForKey:UIImagePickerControllerOriginalImage];
// [self.selectedImageArray addObject:headImage]; // [self.selectedImageArray addObject:headImage];
// [self.publishTableView reloadData]; // [self.publishTableView reloadData];
[self.arrSelectedPhotos addObject:headImage];
if (self.blockFinishSelected) {
self.blockFinishSelected();
}
} }
#pragma mark - 相册选择照片 #pragma mark - 相册选择照片
...@@ -132,19 +137,9 @@ typedef NS_ENUM(NSInteger, ItemIndex) { ...@@ -132,19 +137,9 @@ typedef NS_ENUM(NSInteger, ItemIndex) {
- (void)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index selectedChanged:(BOOL)selected { - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index selectedChanged:(BOOL)selected {
PHAsset *currentPhoto = self.allPhotoArray[index]; PHAsset *currentPhoto = self.allPhotoArray[index];
if (selected) {
[self.arrSelectedAssets addObject:currentPhoto];
} else {
[self.arrSelectedAssets removeObject:currentPhoto];
}
}
- (void)photoBrowserDidFinishModalPresentation:(MWPhotoBrowser *)photoBrowser {
if (self.arrSelectedAssets.count > 3) {
[XBLoadingView showHUDViewWithText:@"图片最多选择3张"];
return;
}
if (selected) {
PHImageManager *imageManager = [PHImageManager defaultManager]; PHImageManager *imageManager = [PHImageManager defaultManager];
PHImageRequestOptions *options = [PHImageRequestOptions new]; PHImageRequestOptions *options = [PHImageRequestOptions new];
options.networkAccessAllowed = YES; options.networkAccessAllowed = YES;
...@@ -152,17 +147,47 @@ typedef NS_ENUM(NSInteger, ItemIndex) { ...@@ -152,17 +147,47 @@ typedef NS_ENUM(NSInteger, ItemIndex) {
options.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat; options.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat;
options.synchronous = YES; options.synchronous = YES;
WS(weakSelf); WS(weakSelf);
[self.arrSelectedPhotos removeAllObjects]; [imageManager requestImageForAsset:currentPhoto
for (PHAsset *asset in self.arrSelectedAssets) {
[imageManager requestImageForAsset:asset
targetSize:CGSizeMake(ScreenWidth, ScreenHeight) targetSize:CGSizeMake(ScreenWidth, ScreenHeight)
contentMode:PHImageContentModeAspectFit contentMode:PHImageContentModeAspectFit
options:options options:options
resultHandler:^(UIImage *result, NSDictionary *info){ resultHandler:^(UIImage *result, NSDictionary *info) {
[self.arrSelectedAssets addObject:currentPhoto];
[weakSelf.arrSelectedPhotos addObject:result]; [weakSelf.arrSelectedPhotos addObject:result];
[weakSelf.cache setObject:result forKey:currentPhoto];
}]; }];
}else{
id result = [self.cache objectForKey:currentPhoto];
[self.arrSelectedAssets removeObject:currentPhoto];
[self.arrSelectedPhotos removeObject:result];
} }
}
- (void)photoBrowserDidFinishModalPresentation:(MWPhotoBrowser *)photoBrowser {
if (self.arrSelectedAssets.count > 3) {
[XBLoadingView showHUDViewWithText:@"图片最多选择3张"];
return;
}
//
// PHImageManager *imageManager = [PHImageManager defaultManager];
// PHImageRequestOptions *options = [PHImageRequestOptions new];
// options.networkAccessAllowed = YES;
// options.resizeMode = PHImageRequestOptionsResizeModeFast;
// options.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat;
// options.synchronous = YES;
// WS(weakSelf);
// [self.arrSelectedPhotos removeAllObjects];
// for (PHAsset *asset in self.arrSelectedAssets) {
// [imageManager requestImageForAsset:asset
// targetSize:CGSizeMake(ScreenWidth, ScreenHeight)
// contentMode:PHImageContentModeAspectFit
// options:options
// resultHandler:^(UIImage *result, NSDictionary *info) {
// [weakSelf.arrSelectedPhotos addObject:result];
// }];
// }
if (self.blockFinishSelected) { if (self.blockFinishSelected) {
self.blockFinishSelected(); self.blockFinishSelected();
} }
...@@ -172,7 +197,12 @@ typedef NS_ENUM(NSInteger, ItemIndex) { ...@@ -172,7 +197,12 @@ typedef NS_ENUM(NSInteger, ItemIndex) {
} }
- (void)selectAlbumImage { - (void)selectAlbumImage {
if (![BaseViewController determinePhotosPermissions]) {
UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"提示" message:@"请在iPad的“设置-隐私-相册”选项中,允许欧立方访问你的相册" preferredStyle:UIAlertControllerStyleAlert];
[alertVC addAction:[UIAlertAction actionWithTitle:@"知道了" style:UIAlertActionStyleCancel handler:nil]];
[self.viewController presentViewController:alertVC animated:YES completion:nil];
return;
}
MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self]; MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
browser.displayActionButton = YES; browser.displayActionButton = YES;
browser.displayNavArrows = YES; browser.displayNavArrows = YES;
...@@ -186,10 +216,34 @@ typedef NS_ENUM(NSInteger, ItemIndex) { ...@@ -186,10 +216,34 @@ typedef NS_ENUM(NSInteger, ItemIndex) {
[self.viewController.navigationController presentViewController:nav animated:YES completion:nil]; [self.viewController.navigationController presentViewController:nav animated:YES completion:nil];
} }
- (void)deletePhotoWithIndex:(NSInteger)index { - (void)deletePhotoWithIndex:(NSInteger)index {
[self.arrSelectedAssets removeObjectAtIndex:index]; UIImage *image = self.arrSelectedPhotos[index];
[self.arrSelectedPhotos removeObjectAtIndex:index];
//如果要删除的照片在缓存里面,那么这是相册选择的照片,需要从缓存删除
for (PHAsset *key in self.cache.allKeys) {
UIImage *cacheImage = [self.cache objectForKey:key];
if ([cacheImage isEqual:image]) {
[self.cache removeObjectForKey:key];
[self.arrSelectedAssets removeObject:key];
break;
}
}
[self.arrSelectedPhotos removeObject:image];
if (self.blockFinishSelected) {
self.blockFinishSelected();
}
}
/**
删除所有的图片
*/
- (void)deleteAll {
[self.arrSelectedAssets removeAllObjects];
[self.arrSelectedPhotos removeAllObjects];
[self.cache removeAllObjects];
if (self.blockFinishSelected) { if (self.blockFinishSelected) {
self.blockFinishSelected(); self.blockFinishSelected();
} }
...@@ -233,6 +287,13 @@ typedef NS_ENUM(NSInteger, ItemIndex) { ...@@ -233,6 +287,13 @@ typedef NS_ENUM(NSInteger, ItemIndex) {
return _arrSelectedPhotos; return _arrSelectedPhotos;
} }
- (NSDictionary *)cache {
if (!_cache) {
_cache = [NSMutableDictionary dictionary];
}
return _cache;
}
/* /*
// Only override drawRect: if you perform custom drawing. // Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation. // An empty implementation adversely affects performance during animation.
......
...@@ -338,6 +338,8 @@ ...@@ -338,6 +338,8 @@
8F0FD1A11EA48EC500D38035 /* ForumDetailBottomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F0FD1A01EA48EC500D38035 /* ForumDetailBottomView.m */; }; 8F0FD1A11EA48EC500D38035 /* ForumDetailBottomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F0FD1A01EA48EC500D38035 /* ForumDetailBottomView.m */; };
8F0FD1A41EA494EA00D38035 /* ForumDetailBottomPictureCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F0FD1A31EA494EA00D38035 /* ForumDetailBottomPictureCell.m */; }; 8F0FD1A41EA494EA00D38035 /* ForumDetailBottomPictureCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F0FD1A31EA494EA00D38035 /* ForumDetailBottomPictureCell.m */; };
8F0FD1A71EA4A8BF00D38035 /* ZJKeyBoardAccessoryView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F0FD1A61EA4A8BF00D38035 /* ZJKeyBoardAccessoryView.m */; }; 8F0FD1A71EA4A8BF00D38035 /* ZJKeyBoardAccessoryView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F0FD1A61EA4A8BF00D38035 /* ZJKeyBoardAccessoryView.m */; };
8F7B45461EA61FED00E52092 /* ForumCommentListViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F7B45451EA61FED00E52092 /* ForumCommentListViewModel.m */; };
8FEF03F31EA7543F00837A64 /* UIImage+Helper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FEF03F21EA7543F00837A64 /* UIImage+Helper.m */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
...@@ -985,6 +987,10 @@ ...@@ -985,6 +987,10 @@
8F0FD1A31EA494EA00D38035 /* ForumDetailBottomPictureCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ForumDetailBottomPictureCell.m; sourceTree = "<group>"; }; 8F0FD1A31EA494EA00D38035 /* ForumDetailBottomPictureCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ForumDetailBottomPictureCell.m; sourceTree = "<group>"; };
8F0FD1A51EA4A8BF00D38035 /* ZJKeyBoardAccessoryView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZJKeyBoardAccessoryView.h; sourceTree = "<group>"; }; 8F0FD1A51EA4A8BF00D38035 /* ZJKeyBoardAccessoryView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZJKeyBoardAccessoryView.h; sourceTree = "<group>"; };
8F0FD1A61EA4A8BF00D38035 /* ZJKeyBoardAccessoryView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZJKeyBoardAccessoryView.m; sourceTree = "<group>"; }; 8F0FD1A61EA4A8BF00D38035 /* ZJKeyBoardAccessoryView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZJKeyBoardAccessoryView.m; sourceTree = "<group>"; };
8F7B45441EA61FED00E52092 /* ForumCommentListViewModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ForumCommentListViewModel.h; sourceTree = "<group>"; };
8F7B45451EA61FED00E52092 /* ForumCommentListViewModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ForumCommentListViewModel.m; sourceTree = "<group>"; };
8FEF03F11EA7543F00837A64 /* UIImage+Helper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+Helper.h"; sourceTree = "<group>"; };
8FEF03F21EA7543F00837A64 /* UIImage+Helper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Helper.m"; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -1777,6 +1783,8 @@ ...@@ -1777,6 +1783,8 @@
2901738A1E0A22940005F48B /* UIButton+countDown.m */, 2901738A1E0A22940005F48B /* UIButton+countDown.m */,
298111101DFE674600F7EAFF /* UIImage+Fit.h */, 298111101DFE674600F7EAFF /* UIImage+Fit.h */,
298111111DFE674600F7EAFF /* UIImage+Fit.m */, 298111111DFE674600F7EAFF /* UIImage+Fit.m */,
8FEF03F11EA7543F00837A64 /* UIImage+Helper.h */,
8FEF03F21EA7543F00837A64 /* UIImage+Helper.m */,
2962D07F1CD1E6010058829D /* UIView+Frame.h */, 2962D07F1CD1E6010058829D /* UIView+Frame.h */,
2962D0801CD1E6010058829D /* UIView+Frame.m */, 2962D0801CD1E6010058829D /* UIView+Frame.m */,
2916A7461D703A1700644C8C /* UIView+cornerRadius.h */, 2916A7461D703A1700644C8C /* UIView+cornerRadius.h */,
...@@ -2311,6 +2319,7 @@ ...@@ -2311,6 +2319,7 @@
29C30BD71DDC1E8C00CA3E29 /* ComprehensiveDiscussion */ = { 29C30BD71DDC1E8C00CA3E29 /* ComprehensiveDiscussion */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8F7B45431EA61FB700E52092 /* ViewModels */,
2999B1301DE6CD760031F79E /* Cells */, 2999B1301DE6CD760031F79E /* Cells */,
2999B12C1DE6CD4F0031F79E /* Controllers */, 2999B12C1DE6CD4F0031F79E /* Controllers */,
298111171DFE9F2C00F7EAFF /* Models */, 298111171DFE9F2C00F7EAFF /* Models */,
...@@ -2885,6 +2894,15 @@ ...@@ -2885,6 +2894,15 @@
name = Pods; name = Pods;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
8F7B45431EA61FB700E52092 /* ViewModels */ = {
isa = PBXGroup;
children = (
8F7B45441EA61FED00E52092 /* ForumCommentListViewModel.h */,
8F7B45451EA61FED00E52092 /* ForumCommentListViewModel.m */,
);
path = ViewModels;
sourceTree = "<group>";
};
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
...@@ -3095,6 +3113,7 @@ ...@@ -3095,6 +3113,7 @@
files = ( files = (
293163FA1DCE3CBA0075129D /* LuckyDrawDetailsViewController.m in Sources */, 293163FA1DCE3CBA0075129D /* LuckyDrawDetailsViewController.m in Sources */,
29CC51ED1E8A011E009FBB6A /* RebateDetailsViewController.m in Sources */, 29CC51ED1E8A011E009FBB6A /* RebateDetailsViewController.m in Sources */,
8F7B45461EA61FED00E52092 /* ForumCommentListViewModel.m in Sources */,
29045F321DCA192700E42A86 /* PromptHeaderTableViewCell.m in Sources */, 29045F321DCA192700E42A86 /* PromptHeaderTableViewCell.m in Sources */,
2940AE9B1DE7FE17001164B0 /* OnlineLearningDetailViewController.m in Sources */, 2940AE9B1DE7FE17001164B0 /* OnlineLearningDetailViewController.m in Sources */,
2986B9A31DE1D30700F4A1CF /* PromotionChooseNavigationController.m in Sources */, 2986B9A31DE1D30700F4A1CF /* PromotionChooseNavigationController.m in Sources */,
...@@ -3377,6 +3396,7 @@ ...@@ -3377,6 +3396,7 @@
29834EC01CDF5E4E001A484F /* ScreeningFirstCollectionViewCell.m in Sources */, 29834EC01CDF5E4E001A484F /* ScreeningFirstCollectionViewCell.m in Sources */,
29834EC51CDF76C1001A484F /* UserViewController.m in Sources */, 29834EC51CDF76C1001A484F /* UserViewController.m in Sources */,
29E2D3271DB88D8B00443170 /* CardOrderInformationReusableView.m in Sources */, 29E2D3271DB88D8B00443170 /* CardOrderInformationReusableView.m in Sources */,
8FEF03F31EA7543F00837A64 /* UIImage+Helper.m in Sources */,
2971E9841DF69F9A00256567 /* CountDownLabel.m in Sources */, 2971E9841DF69F9A00256567 /* CountDownLabel.m in Sources */,
29CC51F81E8A032D009FBB6A /* LuckyDrawMainViewController.m in Sources */, 29CC51F81E8A032D009FBB6A /* LuckyDrawMainViewController.m in Sources */,
2962D06D1CD1A43A0058829D /* ClientViewController.m in Sources */, 2962D06D1CD1A43A0058829D /* ClientViewController.m in Sources */,
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12118" systemVersion="16E195" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
<device id="ipad9_7" orientation="landscape"> <device id="ipad9_7" orientation="landscape">
<adaptation id="fullscreen"/> <adaptation id="fullscreen"/>
</device> </device>
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/> <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/> <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
...@@ -359,7 +359,7 @@ ...@@ -359,7 +359,7 @@
<rect key="frame" x="0.0" y="28" width="1024" height="90"/> <rect key="frame" x="0.0" y="28" width="1024" height="90"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="ctQ-16-eCQ" id="DuY-Eq-G4z"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="ctQ-16-eCQ" id="DuY-Eq-G4z">
<rect key="frame" x="0.0" y="0.0" width="830" height="89"/> <rect key="frame" x="0.0" y="0.0" width="830" height="89.5"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="00登录-谭" translatesAutoresizingMaskIntoConstraints="NO" id="jVJ-Bu-xw9"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="00登录-谭" translatesAutoresizingMaskIntoConstraints="NO" id="jVJ-Bu-xw9">
...@@ -1065,7 +1065,7 @@ ...@@ -1065,7 +1065,7 @@
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<prototypes> <prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="AssessmentHeaderView" id="UfB-K3-NdF" customClass="AssessmentHeaderView"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="AssessmentHeaderView" id="UfB-K3-NdF" customClass="AssessmentHeaderView">
<rect key="frame" x="0.0" y="56" width="460" height="44"/> <rect key="frame" x="0.0" y="55.5" width="460" height="44"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="UfB-K3-NdF" id="WGo-Wa-YTq"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="UfB-K3-NdF" id="WGo-Wa-YTq">
<rect key="frame" x="0.0" y="0.0" width="460" height="44"/> <rect key="frame" x="0.0" y="0.0" width="460" height="44"/>
...@@ -1091,7 +1091,7 @@ ...@@ -1091,7 +1091,7 @@
</connections> </connections>
</tableViewCell> </tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="AssessmentTableViewCell" rowHeight="52" id="gIe-bF-XsX" customClass="AssessmentTableViewCell"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="AssessmentTableViewCell" rowHeight="52" id="gIe-bF-XsX" customClass="AssessmentTableViewCell">
<rect key="frame" x="0.0" y="100" width="460" height="52"/> <rect key="frame" x="0.0" y="99.5" width="460" height="52"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="gIe-bF-XsX" id="Va8-wn-DBM"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="gIe-bF-XsX" id="Va8-wn-DBM">
<rect key="frame" x="0.0" y="0.0" width="460" height="52"/> <rect key="frame" x="0.0" y="0.0" width="460" height="52"/>
...@@ -1137,7 +1137,7 @@ ...@@ -1137,7 +1137,7 @@
</connections> </connections>
</tableViewCell> </tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="AssessmentShortAnswerTableViewCell" rowHeight="112" id="smV-qr-KgP" customClass="AssessmentShortAnswerTableViewCell"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="AssessmentShortAnswerTableViewCell" rowHeight="112" id="smV-qr-KgP" customClass="AssessmentShortAnswerTableViewCell">
<rect key="frame" x="0.0" y="152" width="460" height="112"/> <rect key="frame" x="0.0" y="151.5" width="460" height="112"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="smV-qr-KgP" id="A2f-ek-60T"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="smV-qr-KgP" id="A2f-ek-60T">
<rect key="frame" x="0.0" y="0.0" width="460" height="112"/> <rect key="frame" x="0.0" y="0.0" width="460" height="112"/>
...@@ -1373,7 +1373,7 @@ ...@@ -1373,7 +1373,7 @@
</collectionViewFlowLayout> </collectionViewFlowLayout>
<cells> <cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="CalibrationDetailCollectionCell" id="dGo-4o-u9g" customClass="CalibrationDetailCollectionCell"> <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="CalibrationDetailCollectionCell" id="dGo-4o-u9g" customClass="CalibrationDetailCollectionCell">
<rect key="frame" x="0.0" y="10" width="93" height="41"/> <rect key="frame" x="0.0" y="9.5" width="93" height="41"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="93" height="41"/> <rect key="frame" x="0.0" y="0.0" width="93" height="41"/>
...@@ -1453,7 +1453,7 @@ ...@@ -1453,7 +1453,7 @@
</collectionViewFlowLayout> </collectionViewFlowLayout>
<cells> <cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="CalibrationCollectionViewCell" id="v20-Kz-8OX" customClass="CalibrationCollectionViewCell"> <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="CalibrationCollectionViewCell" id="v20-Kz-8OX" customClass="CalibrationCollectionViewCell">
<rect key="frame" x="0.0" y="5" width="50" height="50"/> <rect key="frame" x="0.0" y="4.5" width="50" height="50"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/> <rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
...@@ -2157,7 +2157,7 @@ ...@@ -2157,7 +2157,7 @@
<rect key="frame" x="0.0" y="28" width="1024" height="100"/> <rect key="frame" x="0.0" y="28" width="1024" height="100"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Qnm-0r-wEL" id="VAA-bT-OlF"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Qnm-0r-wEL" id="VAA-bT-OlF">
<rect key="frame" x="0.0" y="0.0" width="1024" height="99"/> <rect key="frame" x="0.0" y="0.0" width="1024" height="99.5"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="课时简介" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="agZ-rF-DnB"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="课时简介" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="agZ-rF-DnB">
...@@ -2189,7 +2189,7 @@ ...@@ -2189,7 +2189,7 @@
<rect key="frame" x="0.0" y="128" width="1024" height="130"/> <rect key="frame" x="0.0" y="128" width="1024" height="130"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="WzB-nZ-wsW" id="Zzv-Yi-ZxT"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="WzB-nZ-wsW" id="Zzv-Yi-ZxT">
<rect key="frame" x="0.0" y="0.0" width="1024" height="129"/> <rect key="frame" x="0.0" y="0.0" width="1024" height="129.5"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="授课讲师" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kxK-dX-OAf"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="授课讲师" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kxK-dX-OAf">
...@@ -2246,7 +2246,7 @@ ...@@ -2246,7 +2246,7 @@
<rect key="frame" x="0.0" y="258" width="1024" height="100"/> <rect key="frame" x="0.0" y="258" width="1024" height="100"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="oia-jO-L9n" id="AMF-ag-ZWN"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="oia-jO-L9n" id="AMF-ag-ZWN">
<rect key="frame" x="0.0" y="0.0" width="1024" height="99"/> <rect key="frame" x="0.0" y="0.0" width="1024" height="99.5"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" text="针对人员" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NfI-IM-h1i"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" text="针对人员" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NfI-IM-h1i">
...@@ -2747,7 +2747,7 @@ ...@@ -2747,7 +2747,7 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes> <prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="AssessmentHeaderView" rowHeight="60" id="2M5-To-MLj" customClass="AssessmentHeaderView"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="AssessmentHeaderView" rowHeight="60" id="2M5-To-MLj" customClass="AssessmentHeaderView">
<rect key="frame" x="0.0" y="56" width="1024" height="60"/> <rect key="frame" x="0.0" y="55.5" width="1024" height="60"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2M5-To-MLj" id="ypf-GL-4CP"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2M5-To-MLj" id="ypf-GL-4CP">
<rect key="frame" x="0.0" y="0.0" width="1024" height="60"/> <rect key="frame" x="0.0" y="0.0" width="1024" height="60"/>
...@@ -2773,7 +2773,7 @@ ...@@ -2773,7 +2773,7 @@
</connections> </connections>
</tableViewCell> </tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="AssessmentTableViewCell" rowHeight="50" id="BjI-a1-CRm" customClass="AssessmentTableViewCell"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="AssessmentTableViewCell" rowHeight="50" id="BjI-a1-CRm" customClass="AssessmentTableViewCell">
<rect key="frame" x="0.0" y="116" width="1024" height="50"/> <rect key="frame" x="0.0" y="115.5" width="1024" height="50"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="BjI-a1-CRm" id="bq8-ly-DcD"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="BjI-a1-CRm" id="bq8-ly-DcD">
<rect key="frame" x="0.0" y="0.0" width="1024" height="50"/> <rect key="frame" x="0.0" y="0.0" width="1024" height="50"/>
...@@ -3145,7 +3145,7 @@ ...@@ -3145,7 +3145,7 @@
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8Th-tT-RVY"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8Th-tT-RVY">
<rect key="frame" x="20" y="260" width="984" height="34"/> <rect key="frame" x="20" y="245" width="984" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/> <fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="textColor"/> <nil key="textColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
...@@ -3168,20 +3168,20 @@ ...@@ -3168,20 +3168,20 @@
<constraint firstAttribute="height" constant="1" id="fAA-nf-dma"/> <constraint firstAttribute="height" constant="1" id="fAA-nf-dma"/>
</constraints> </constraints>
</view> </view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="b31-hr-5yT"> <view tag="1111" contentMode="scaleAspectFill" translatesAutoresizingMaskIntoConstraints="NO" id="b31-hr-5yT">
<rect key="frame" x="20" y="88" width="400" height="164"/> <rect key="frame" x="20" y="73" width="400" height="164"/>
<subviews> <subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Od7-sI-lw9"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Od7-sI-lw9">
<rect key="frame" x="0.0" y="0.0" width="128" height="164"/> <rect key="frame" x="0.0" y="0.0" width="128" height="164"/>
</imageView> </imageView>
<imageView userInteractionEnabled="NO" tag="2" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="FpA-hd-kLS"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" tag="2" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="FpA-hd-kLS">
<rect key="frame" x="272" y="0.0" width="128" height="164"/> <rect key="frame" x="272" y="0.0" width="128" height="164"/>
</imageView> </imageView>
<imageView userInteractionEnabled="NO" tag="1" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="BTw-Cs-JhN"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" tag="1" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="BTw-Cs-JhN">
<rect key="frame" x="136" y="0.0" width="128" height="164"/> <rect key="frame" x="136" y="0.0" width="128" height="164"/>
</imageView> </imageView>
</subviews> </subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints> <constraints>
<constraint firstItem="BTw-Cs-JhN" firstAttribute="top" secondItem="b31-hr-5yT" secondAttribute="top" id="1oR-kk-w8t"/> <constraint firstItem="BTw-Cs-JhN" firstAttribute="top" secondItem="b31-hr-5yT" secondAttribute="top" id="1oR-kk-w8t"/>
<constraint firstItem="FpA-hd-kLS" firstAttribute="width" secondItem="Od7-sI-lw9" secondAttribute="width" id="4IH-iu-WUq"/> <constraint firstItem="FpA-hd-kLS" firstAttribute="width" secondItem="Od7-sI-lw9" secondAttribute="width" id="4IH-iu-WUq"/>
...@@ -3201,21 +3201,20 @@ ...@@ -3201,21 +3201,20 @@
</view> </view>
</subviews> </subviews>
<constraints> <constraints>
<constraint firstItem="pyu-Y7-w8M" firstAttribute="centerY" secondItem="iVT-bi-RKr" secondAttribute="centerY" constant="-109" id="0uV-p1-8pa"/>
<constraint firstAttribute="bottom" secondItem="qn5-UZ-cM4" secondAttribute="bottom" id="4pS-CA-0MD"/> <constraint firstAttribute="bottom" secondItem="qn5-UZ-cM4" secondAttribute="bottom" id="4pS-CA-0MD"/>
<constraint firstItem="8Th-tT-RVY" firstAttribute="leading" secondItem="iVT-bi-RKr" secondAttribute="leading" constant="20" id="52a-nf-bps"/> <constraint firstItem="8Th-tT-RVY" firstAttribute="leading" secondItem="iVT-bi-RKr" secondAttribute="leading" constant="20" id="52a-nf-bps"/>
<constraint firstItem="b31-hr-5yT" firstAttribute="top" secondItem="pyu-Y7-w8M" secondAttribute="bottom" constant="15" id="9Lt-gM-InY"/> <constraint firstItem="b31-hr-5yT" firstAttribute="top" secondItem="pyu-Y7-w8M" secondAttribute="bottom" id="9Lt-gM-InY"/>
<constraint firstItem="VAs-Wx-TQb" firstAttribute="leading" secondItem="iVT-bi-RKr" secondAttribute="leadingMargin" constant="20" id="A23-1U-p4J"/> <constraint firstItem="VAs-Wx-TQb" firstAttribute="leading" secondItem="iVT-bi-RKr" secondAttribute="leadingMargin" constant="20" id="A23-1U-p4J"/>
<constraint firstAttribute="bottom" secondItem="8Th-tT-RVY" secondAttribute="bottom" constant="10" id="GHM-g1-aWA"/> <constraint firstAttribute="bottom" secondItem="8Th-tT-RVY" secondAttribute="bottom" constant="10" id="GHM-g1-aWA"/>
<constraint firstItem="Nam-PB-SZa" firstAttribute="leading" secondItem="mfw-jx-1kt" secondAttribute="leading" id="LH1-AC-vh1"/> <constraint firstItem="Nam-PB-SZa" firstAttribute="leading" secondItem="mfw-jx-1kt" secondAttribute="leading" id="LH1-AC-vh1"/>
<constraint firstItem="mfw-jx-1kt" firstAttribute="top" secondItem="VAs-Wx-TQb" secondAttribute="top" id="LZO-yf-dpe"/> <constraint firstItem="mfw-jx-1kt" firstAttribute="top" secondItem="VAs-Wx-TQb" secondAttribute="top" id="LZO-yf-dpe"/>
<constraint firstItem="8Th-tT-RVY" firstAttribute="top" secondItem="iVT-bi-RKr" secondAttribute="top" constant="260" id="OyM-WB-gzg"/>
<constraint firstItem="mfw-jx-1kt" firstAttribute="leading" secondItem="VAs-Wx-TQb" secondAttribute="trailing" constant="5" id="TQh-0R-Fcz"/> <constraint firstItem="mfw-jx-1kt" firstAttribute="leading" secondItem="VAs-Wx-TQb" secondAttribute="trailing" constant="5" id="TQh-0R-Fcz"/>
<constraint firstItem="qn5-UZ-cM4" firstAttribute="leading" secondItem="iVT-bi-RKr" secondAttribute="leading" id="Ttv-ma-62V"/> <constraint firstItem="qn5-UZ-cM4" firstAttribute="leading" secondItem="iVT-bi-RKr" secondAttribute="leading" id="Ttv-ma-62V"/>
<constraint firstItem="8Th-tT-RVY" firstAttribute="top" secondItem="b31-hr-5yT" secondAttribute="bottom" constant="8" id="bak-X4-GJw"/> <constraint firstItem="8Th-tT-RVY" firstAttribute="top" secondItem="b31-hr-5yT" secondAttribute="bottom" constant="8" id="bak-X4-GJw"/>
<constraint firstItem="b31-hr-5yT" firstAttribute="leading" secondItem="iVT-bi-RKr" secondAttribute="leading" constant="20" id="gUS-uZ-YEu"/> <constraint firstItem="b31-hr-5yT" firstAttribute="leading" secondItem="iVT-bi-RKr" secondAttribute="leading" constant="20" id="gUS-uZ-YEu"/>
<constraint firstItem="G4o-Xy-Sd4" firstAttribute="centerY" secondItem="VAs-Wx-TQb" secondAttribute="centerY" id="iL8-0n-q90"/> <constraint firstItem="G4o-Xy-Sd4" firstAttribute="centerY" secondItem="VAs-Wx-TQb" secondAttribute="centerY" id="iL8-0n-q90"/>
<constraint firstItem="pyu-Y7-w8M" firstAttribute="centerX" secondItem="iVT-bi-RKr" secondAttribute="centerX" constant="-200" id="ifw-ag-xtC"/> <constraint firstItem="pyu-Y7-w8M" firstAttribute="centerX" secondItem="iVT-bi-RKr" secondAttribute="centerX" constant="-200" id="ifw-ag-xtC"/>
<constraint firstItem="pyu-Y7-w8M" firstAttribute="top" secondItem="iVT-bi-RKr" secondAttribute="top" constant="13" id="l4v-Ll-rbG"/>
<constraint firstAttribute="trailing" secondItem="qn5-UZ-cM4" secondAttribute="trailing" id="ndM-Oc-58s"/> <constraint firstAttribute="trailing" secondItem="qn5-UZ-cM4" secondAttribute="trailing" id="ndM-Oc-58s"/>
<constraint firstAttribute="trailing" secondItem="G4o-Xy-Sd4" secondAttribute="trailing" constant="30" id="saS-eK-h2C"/> <constraint firstAttribute="trailing" secondItem="G4o-Xy-Sd4" secondAttribute="trailing" constant="30" id="saS-eK-h2C"/>
<constraint firstItem="Nam-PB-SZa" firstAttribute="bottom" secondItem="VAs-Wx-TQb" secondAttribute="bottom" id="tv1-1o-GqD"/> <constraint firstItem="Nam-PB-SZa" firstAttribute="bottom" secondItem="VAs-Wx-TQb" secondAttribute="bottom" id="tv1-1o-GqD"/>
......
//
// UIImage+Helper.h
// CXA
//
// Created by Xummer on 14-3-3.
// Copyright (c) 2014年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImage (Helper)
+ (UIImage *)getThumbnailImage:(UIImage *)image withMaxLen:(CGFloat)maxLen;
- (UIImage *)thumbnailWithMaxLen:(CGFloat)maxLen;
- (UIImage *)imageWithTintColor:(UIColor *)tintColor;
- (UIImage *)imageWithGradientTintColor:(UIColor *)tintColor;
- (UIImage *)imageWithTintColor:(UIColor *)tintColor blendMode:(CGBlendMode)blendMode;
@end
@interface UIImage (Color)
+ (UIImage *)imageWithColor:(UIColor *)color;
+ (UIImage *)imageWithColor:(UIColor *)color andSize:(CGSize)size;
+ (UIImage *)imageWithColor:(UIColor *)color andRect:(CGRect)rect;
- (UIImage *)greyScaleImage;
/**
* 图片压缩到指定大小(具体看图片大小,过大的图片无法压缩到指定大小)
*
* @param kb 压缩后图片大小
*
* @return
*/
- (NSData *)scaledToSpaceMaxSize:(NSInteger)kb;
/**
* 压缩图片到指定高宽
*
* @param newSize 新的图片尺寸
*
* @return
*/
- (UIImage *)scaledToSize:(CGSize)newSize;
/**
* 按比例压缩图片至指定宽度
*
* @param newWidth 指定宽度
*
* @return
*/
- (UIImage *)scaledToWidth:(NSInteger)newWidth;
/**
* 获取图片缩略图
*
* @param sourceImage 原始图片
* @param size 生成尺寸
*
* @return 新的图片
*/
+ (UIImage *)imageCompressForSize:(UIImage *)sourceImage targetSize:(CGSize)size;
@end
//
// UIImage+Helper.m
// CXA
//
// Created by Xummer on 14-3-3.
// Copyright (c) 2014年 Xummer. All rights reserved.
//
#import "UIImage+Helper.h"
@implementation UIImage (Helper)
// if newImage's width or heigth < 1, image will be cliped
+ (UIImage *)getThumbnailImage:(UIImage *)image withMaxLen:(CGFloat)maxLen
{
CGFloat imageMaxLen, imageMinLen;
BOOL widthIsLarger = image.size.width > image.size.height;
if (widthIsLarger) {
imageMaxLen = image.size.width;
imageMinLen = image.size.height;
}
else {
imageMaxLen = image.size.height;
imageMinLen = image.size.width;
}
if (imageMaxLen > maxLen) {
CGFloat scaleFloat = maxLen/imageMaxLen;
CGFloat newImgMinL = imageMinLen * scaleFloat;
CGSize size;
if (newImgMinL < 1) {
scaleFloat = 1/imageMinLen;
if (widthIsLarger) {
size = CGSizeMake(maxLen, image.size.height * scaleFloat);
}
else {
size = CGSizeMake(image.size.width * scaleFloat, maxLen);
}
}
else {
size = CGSizeMake(image.size.width * scaleFloat,
image.size.height * scaleFloat);
}
UIGraphicsBeginImageContext(size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGAffineTransform transform = CGAffineTransformIdentity;
transform = CGAffineTransformScale(transform, scaleFloat, scaleFloat);
CGContextConcatCTM(context, transform);
// Draw the image into the transformed context and return the image
[image drawAtPoint:CGPointMake(0.0f, 0.0f)];
UIImage *newimg = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newimg;
}
else{
return image;
}
}
- (UIImage *)thumbnailWithMaxLen:(CGFloat)maxLen {
return [[self class] getThumbnailImage:self withMaxLen:maxLen];
}
- (UIImage *)imageWithTintColor:(UIColor *)tintColor {
return [self imageWithTintColor:tintColor blendMode:kCGBlendModeDestinationIn];
}
- (UIImage *)imageWithGradientTintColor:(UIColor *)tintColor {
return [self imageWithTintColor:tintColor blendMode:kCGBlendModeOverlay];
}
- (UIImage *)imageWithTintColor:(UIColor *)tintColor blendMode:(CGBlendMode)blendMode
{
//We want to keep alpha, set opaque to NO; Use 0.0f for scale to use the scale factor of the device’s main screen.
UIGraphicsBeginImageContextWithOptions(self.size, NO, 0.0f);
[tintColor setFill];
CGRect bounds = CGRectMake(0, 0, self.size.width, self.size.height);
UIRectFill(bounds);
//Draw the tinted image in context
[self drawInRect:bounds blendMode:blendMode alpha:1.0f];
if (blendMode != kCGBlendModeDestinationIn) {
[self drawInRect:bounds blendMode:kCGBlendModeDestinationIn alpha:1.0f];
}
UIImage *tintedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return tintedImage;
}
@end
@implementation UIImage (Color)
typedef enum {
ALPHA = 0,
BLUE = 1,
GREEN = 2,
RED = 3
} PIXELS;
+ (UIImage *)imageWithColor:(UIColor *)color {
CGRect rect = CGRectMake(0.0f,0.0f,1.0f,1.0f);
return [[self class] imageWithColor:color andRect:rect];
}
+ (UIImage *)imageWithColor:(UIColor *)color andRect:(CGRect)rect {
UIGraphicsBeginImageContext(rect.size);
CGContextRef context =UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context,[color CGColor]);
CGContextFillRect(context, rect);
UIImage *image =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
+ (UIImage *)imageWithColor:(UIColor *)color andSize:(CGSize)size {
return [[self class] imageWithColor:color andRect:(CGRect){
.origin = CGPointZero,
.size = size
}];
}
- (UIImage *)greyScaleImage {
CGSize size = [self size];
int width = size.width;
int height = size.height;
// the pixels will be painted to this array
uint32_t *pixels = (uint32_t *) malloc(width * height * sizeof(uint32_t));
// clear the pixels so any transparency is preserved
memset(pixels, 0, width * height * sizeof(uint32_t));
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
// create a context with RGBA pixels
CGContextRef context = CGBitmapContextCreate(pixels, width, height, 8, width * sizeof(uint32_t), colorSpace,
kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedLast);
// paint the bitmap to our context which will fill in the pixels array
CGContextDrawImage(context, CGRectMake(0, 0, width, height), [self CGImage]);
for(int y = 0; y < height; y++) {
for(int x = 0; x < width; x++) {
uint8_t *rgbaPixel = (uint8_t *) &pixels[y * width + x];
// convert to grayscale using recommended method: http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
uint32_t gray = 0.3 * rgbaPixel[RED] + 0.59 * rgbaPixel[GREEN] + 0.11 * rgbaPixel[BLUE];
// set the pixels to gray
rgbaPixel[RED] = gray;
rgbaPixel[GREEN] = gray;
rgbaPixel[BLUE] = gray;
}
}
// create a new CGImageRef from our context with the modified pixels
CGImageRef image = CGBitmapContextCreateImage(context);
// we're done with the context, color space, and pixels
CGContextRelease(context);
CGColorSpaceRelease(colorSpace);
free(pixels);
// make a new UIImage to return
UIImage *resultUIImage = [UIImage imageWithCGImage:image];
// we're done with image now too
CGImageRelease(image);
return resultUIImage;
}
- (NSData *)scaledToSpaceMaxSize:(NSInteger)kb {
//压缩到100kb以内
CGFloat compression = 0.5f;
CGFloat maxCompression = 0.1f;
NSUInteger maxlength = kb * 1024;
NSData *imgData = UIImageJPEGRepresentation(self, compression);
// CLog(@"处理之前的大小--->%lukB",(unsigned long)imgData.length/1024);
while ([imgData length] > maxlength && compression > maxCompression) {
compression -= 0.1;
imgData = UIImageJPEGRepresentation(self, compression);
}
// CLog(@"处理之后的大小--->%lukB",(unsigned long)imgData.length/1024);
return imgData;
}
- (UIImage *)scaledToSize:(CGSize)newSize {
UIGraphicsBeginImageContextWithOptions(newSize, YES, 0);
[self drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return scaledImage;
}
- (UIImage *)scaledToWidth:(NSInteger)newWidth {
CGSize newSize = CGSizeMake(newWidth, newWidth / self.size.width * self.size.height);
UIGraphicsBeginImageContextWithOptions(newSize, YES, 0);
[self drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return scaledImage;
}
#pragma mark - 获取缩略图
+ (UIImage *)imageCompressForSize:(UIImage *)sourceImage targetSize:(CGSize)size
{
UIImage *newImage = nil;
CGSize imageSize = sourceImage.size;
CGFloat width = imageSize.width;
CGFloat height = imageSize.height;
CGFloat targetWidth = size.width;
CGFloat targetHeight = size.height;
CGFloat scaleFactor = 0.0;
CGFloat scaledWidth = targetWidth;
CGFloat scaledHeight = targetHeight;
CGPoint thumbnailPoint = CGPointMake(0.0, 0.0);
if(CGSizeEqualToSize(imageSize, size) == NO){
CGFloat widthFactor = targetWidth / width;
CGFloat heightFactor = targetHeight / height;
if(widthFactor > heightFactor){
scaleFactor = widthFactor;
}
else{
scaleFactor = heightFactor;
}
scaledWidth = width * scaleFactor;
scaledHeight = height * scaleFactor;
if(widthFactor > heightFactor){
thumbnailPoint.y = (targetHeight - scaledHeight) * 0.5;
}else if(widthFactor < heightFactor){
thumbnailPoint.x = (targetWidth - scaledWidth) * 0.5;
}
}
UIGraphicsBeginImageContextWithOptions(size, NO, 3.0);
CGRect thumbnailRect = CGRectZero;
thumbnailRect.origin = thumbnailPoint;
thumbnailRect.size.width = scaledWidth;
thumbnailRect.size.height = scaledHeight;
[sourceImage drawInRect:thumbnailRect];
newImage = UIGraphicsGetImageFromCurrentImageContext();
if(newImage == nil){
NSLog(@"scale image fail");
}
UIGraphicsEndImageContext();
return newImage;
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment