Commit 4cd76b1f authored by admin's avatar admin

修复bug

parent 17f1e76c
......@@ -154,6 +154,7 @@
84ECCF1B1C0210F000EA4960 /* CommentModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84ECCF1A1C0210F000EA4960 /* CommentModel.m */; };
84ED5DD81BF2E64300A1BB6D /* ScreenView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84ED5DD71BF2E64300A1BB6D /* ScreenView.m */; };
84EE92771C2FFDEB000EF5BF /* AttachmentModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84EE92761C2FFDEB000EF5BF /* AttachmentModel.m */; };
84EE927A1C30E124000EF5BF /* UIImage+Fit.m in Sources */ = {isa = PBXBuildFile; fileRef = 84EE92791C30E124000EF5BF /* UIImage+Fit.m */; };
84F1669B1BE715E40061D350 /* ZanButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F1669A1BE715E40061D350 /* ZanButton.m */; };
84F30DA41BFC19F200CBAD13 /* RankListModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F30DA31BFC19F200CBAD13 /* RankListModel.m */; };
84F57C461BEC388A00DDEEB1 /* CommentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F57C451BEC388A00DDEEB1 /* CommentView.m */; };
......@@ -480,6 +481,8 @@
84ED5DD71BF2E64300A1BB6D /* ScreenView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScreenView.m; sourceTree = "<group>"; };
84EE92751C2FFDEB000EF5BF /* AttachmentModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AttachmentModel.h; sourceTree = "<group>"; };
84EE92761C2FFDEB000EF5BF /* AttachmentModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AttachmentModel.m; sourceTree = "<group>"; };
84EE92781C30E124000EF5BF /* UIImage+Fit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+Fit.h"; sourceTree = "<group>"; };
84EE92791C30E124000EF5BF /* UIImage+Fit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Fit.m"; sourceTree = "<group>"; };
84F166991BE715E40061D350 /* ZanButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZanButton.h; sourceTree = "<group>"; };
84F1669A1BE715E40061D350 /* ZanButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZanButton.m; sourceTree = "<group>"; };
84F30DA21BFC19F200CBAD13 /* RankListModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankListModel.h; sourceTree = "<group>"; };
......@@ -1676,6 +1679,8 @@
84C9574A1BDB344900083584 /* UIBarButtonItem+Create.m */,
84C9574B1BDB344900083584 /* UIView+Frame.h */,
84C9574C1BDB344900083584 /* UIView+Frame.m */,
84EE92781C30E124000EF5BF /* UIImage+Fit.h */,
84EE92791C30E124000EF5BF /* UIImage+Fit.m */,
);
path = Category;
sourceTree = "<group>";
......@@ -2470,6 +2475,7 @@
84B4765A1C2E4B37006C6488 /* PicCategoryViewController.m in Sources */,
84D3E6021C04DA85001FF1DD /* InspectUpLoadFootView.m in Sources */,
84A673881C0B50B4000F828E /* OnLineCompleteViewController.m in Sources */,
84EE927A1C30E124000EF5BF /* UIImage+Fit.m in Sources */,
8474C5991BE78BBC007DCF19 /* QuestionDetailCell.m in Sources */,
8474C5911BE78A85007DCF19 /* QuestionListTableCell.m in Sources */,
8490C4D71BF9DF1D006B6569 /* PictureStoryViewController.m in Sources */,
......
......@@ -13,7 +13,7 @@
#define kRedStarURL @"http://218.244.151.129:7580/"
// 正式环境
// #define kRedStarURL @"http://219.235.234.225:7580/"
//#define kRedStarURL @"http://219.235.234.225:7580/"
// 检查更新
......
......@@ -8,7 +8,7 @@
#import "AddPicTextTableViewCell.h"
@interface AddPicTextTableViewCell ()
@interface AddPicTextTableViewCell () <UITextViewDelegate>
@property (nonatomic, strong) UIImageView *backImageView1;
@property (nonatomic, strong) UILabel *placeholderLabel2;
@property (nonatomic, strong) UIView *lineView;
......@@ -137,6 +137,7 @@
{
if (!_titleTextView) {
_titleTextView = [[UITextView alloc] init];
_titleTextView.delegate = self;
_titleTextView.font = [UIFont systemFontOfSize:15.0];
_titleTextView.translatesAutoresizingMaskIntoConstraints = NO;
[self.backImageView1 addSubview:_titleTextView];
......@@ -183,7 +184,31 @@
}
#pragma mark - UItextView
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
if (![text isEqualToString:@""]) {
self.placeholderLabel2.hidden = YES;
}
if ([text isEqualToString:@""] && range.location == 0 && range.length == 1) {
self.placeholderLabel2.hidden = NO;
}
if ([text isEqualToString:@"\n"]) {
[self.titleTextView resignFirstResponder];
if (textView.text.length != 0) {
self.placeholderLabel2.hidden = YES;
} else {
self.placeholderLabel2.hidden = NO;
}
return NO;
}
return YES;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
......
......@@ -13,6 +13,8 @@
#import "CheckPicViewController.h"
#import "HttpClient.h"
#import "UIImage+Fit.h"
#import "CommonFunc.h"
#define kAddPicTableViewCell @"addPicTableCell"
#define kAddPicTextTableViewCell @"addPicTextTableCell"
......@@ -172,11 +174,9 @@
- (void)saveImage:(UIImage *)currentImage {
NSData *imageData = UIImageJPEGRepresentation(currentImage, 0.5);
NSString *imageName = [NSString stringWithFormat:@"picture%d", (int)_imageNameArray.count];
NSString *imageName = [CommonFunc md5Data:imageData];
[_imageNameArray addObject:imageName];
// 获取沙盒目录
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
// 将图片写入文件
......@@ -371,7 +371,7 @@
NSString *imageName = _imageNameArray[indexPath.row - 1];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
UIImage *image00 = [self cutImage:image];
UIImage *image00 = [UIImage image:image fillSize:CGSizeMake((kScreenWidth - 60) / 2, 90)];
[cell.photoButton setImage:image00 forState:UIControlStateNormal];
[cell.photoButton removeTarget:self action:@selector(createImagePicker:) forControlEvents:UIControlEventTouchUpInside];
[cell.photoButton addTarget:self action:@selector(showBigPic:) forControlEvents:UIControlEventTouchUpInside];
......@@ -386,44 +386,17 @@
NSString *imageName = _imageNameArray[indexPath.row - 1];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
UIImage *image00 = [self cutImage:image];
UIImage *image00 = [UIImage image:image fillSize:CGSizeMake((kScreenWidth - 60) / 2, 90)];
[cell.photoButton setImage:image00 forState:UIControlStateNormal];
[cell.photoButton removeTarget:self action:@selector(createImagePicker:) forControlEvents:UIControlEventTouchUpInside];
[cell.photoButton addTarget:self action:@selector(showBigPic:) forControlEvents:UIControlEventTouchUpInside];
cell.titleTextView.userInteractionEnabled = NO;
}
}
cell.titleTextView.delegate = self;
return cell;
}
}
//裁剪图片
- (UIImage *)cutImage:(UIImage*)image
{
//压缩图片
CGSize newSize;
CGImageRef imageRef = nil;
if ((image.size.width / image.size.height) < (((kScreenWidth - 20 * 3) / 2) / 90)) {
newSize.width = image.size.width;
newSize.height = image.size.width * 90 / ((kScreenWidth - 20 * 3) / 2);
imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(0, fabs(image.size.height - newSize.height) / 2, newSize.width, newSize.height));
} else {
newSize.height = image.size.height;
newSize.width = image.size.height * ((kScreenWidth - 20 * 3) / 2) / 90;
imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(fabs(image.size.width - newSize.width) / 2, 0, newSize.width, newSize.height));
}
return [UIImage imageWithCGImage:imageRef];
}
#pragma mark - lazy loading
- (UITableView *)tableView
{
......
......@@ -23,7 +23,6 @@
@property (nonatomic, strong) UITextView *textView2;
@property (nonatomic, strong) StateTableView *stateTableView;
@property (nonatomic, strong) TimeTableView *timeTableView;
@end
......@@ -41,24 +41,24 @@
- (void)setup
{
self.groupTabBar = [[GroupTabBar alloc] initWithFrame:CGRectMake(0, 0, 100, 250)];
self.groupTabBar = [[GroupTabBar alloc] initWithFrame:CGRectMake(0, 0, 100, 200)];
_groupTabBar.delegate = self;
[self addSubview:_groupTabBar];
self.scopeTableView = [[ScopeTableView alloc] initWithTitle:[NSMutableArray arrayWithObjects:@"所有口碑", @"我的口碑", nil]];
GroupItems *scopeItem = [[GroupItems alloc] initWithTitle:@"问题范围" view:_scopeTableView];
GroupItems *scopeItem = [[GroupItems alloc] initWithTitle:@"口碑范围" view:_scopeTableView];
self.textView1 = [[UITextView alloc] init];
_textView1.delegate = self;
_textView1.tag = 9991;
self.placeholderLabel1 = [[UILabel alloc] initWithFrame:CGRectMake(5, 0, 100, 30)];
self.placeholderLabel1.text = @"请输入标题...";
self.placeholderLabel1.text = @"请输入内容...";
self.placeholderLabel1.font = [UIFont systemFontOfSize:15.0];
self.placeholderLabel1.textColor = kOnLineCellDetailColor;
[self.textView1 addSubview:self.placeholderLabel1];
GroupItems *textViewItem1 = [[GroupItems alloc] initWithTitle:@"标题类似于" view:_textView1];
GroupItems *textViewItem1 = [[GroupItems alloc] initWithTitle:@"内容类似于" view:_textView1];
self.textView2 = [[UITextView alloc] init];
_textView2.delegate = self;
......@@ -70,19 +70,15 @@
[self.textView2 addSubview:self.placeholderLabel2];
GroupItems *textViewItem2 = [[GroupItems alloc] initWithTitle:@"关键字类似于" view:_textView2];
self.stateTableView = [[StateTableView alloc] init];
GroupItems *stateItem = [[GroupItems alloc] initWithTitle:@"问题状态" view:_stateTableView];
self.timeTableView = [[TimeTableView alloc] init];
GroupItems *timeItem = [[GroupItems alloc] initWithTitle:@"时间段" view:_timeTableView];
[self insertSubview:_scopeTableView belowSubview:_groupTabBar];
[self insertSubview:_textView1 belowSubview:_groupTabBar];
[self insertSubview:_textView2 belowSubview:_groupTabBar];
[self insertSubview:_stateTableView belowSubview:_groupTabBar];
[self insertSubview:_timeTableView belowSubview:_groupTabBar];
_groupTabBar.items = @[scopeItem, textViewItem1, textViewItem2, stateItem, timeItem];
_groupTabBar.items = @[scopeItem, textViewItem1, textViewItem2, timeItem];
[_groupTabBar showIndex:0];
self.backView.backgroundColor = [UIColor whiteColor];
......
......@@ -27,7 +27,7 @@
#define kPictureTableViewCell @"pictureTabelViewCell"
@interface PictureViewController () <UITableViewDelegate, UITableViewDataSource, TaxisViewDelegate,ScopeTableViewDelegate, StateTableViewDelegate, TimeTableViewDelegate >
@interface PictureViewController () <UITableViewDelegate, UITableViewDataSource, TaxisViewDelegate,ScopeTableViewDelegate, TimeTableViewDelegate >
@property (nonatomic, strong) MenuView *menuView;
@property (nonatomic, strong) TaxisView *taxisView;
......@@ -337,7 +337,6 @@
if (!_screenView) {
_screenView = [[PicScreenView alloc] init];
_screenView.scopeTableView.scopeDeleagte = self;
_screenView.stateTableView.stateDeleagte = self;
_screenView.timeTableView.timeDeleagte = self;
_screenView.backgroundColor = [UIColor whiteColor];
}
......@@ -350,7 +349,7 @@
_bgView.alpha = 0;
_bgView.backgroundColor = [UIColor blackColor];
CGRect toFrame = CGRectMake(0, 45, kScreenWidth, 310);
CGRect toFrame = CGRectMake(0, 45, kScreenWidth, 260);
_screenView.alpha = 0.0;
_screenView.frame = toFrame;
[UIView animateWithDuration:0.3 animations:^{
......@@ -380,7 +379,6 @@
NSInteger selectedIndex = 0;
NSIndexPath *selectedIndexPath = [NSIndexPath indexPathForRow:selectedIndex inSection:0];
[_screenView.scopeTableView selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
[_screenView.stateTableView selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
[_screenView.timeTableView selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
_screenView.textView1.text = @"";
......@@ -433,8 +431,6 @@
[parameters setObject:array forKey:@"queryOrders"];
} else if (_screenView.groupTabBar.selectNumber == 3) {
} else if (_screenView.groupTabBar.selectNumber == 4) {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
......@@ -537,11 +533,6 @@
}
- (void)stateTableViewClick:(NSInteger)row
{
_stateRow = row;
}
- (void)timeTableViewClick:(NSInteger)row
{
_timeRow = row;
......
......@@ -18,6 +18,7 @@
#import "HttpClient.h"
#import <MBProgressHUD.h>
#import "AddQuestionTableCell.h"
#import "UIImage+Fit.h"
#define kPhotoTag 3339922
......@@ -153,7 +154,7 @@
- (void)saveImage:(UIImage *)currentImage {
NSData *imageData = UIImageJPEGRepresentation(currentImage, 0.5);
NSString *imageName = [NSString stringWithFormat:@"imageName%d", (int)_imageNameArray.count];
NSString *imageName = [CommonFunc md5Data:imageData];
[_imageNameArray addObject:imageName];
......@@ -408,7 +409,7 @@
NSString *imageName = _imageNameArray[_imageNameArray.count - 1];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
UIImage *image00 = [self cutImage:image];
UIImage *image00 = [UIImage image:image fillSize:CGSizeMake((kScreenWidth - 60) / 2, 90)];
cell.photoButton1.tag = kPhotoTag + _imageNameArray.count - 1;
[cell.photoButton1 setImage:image00 forState:UIControlStateNormal];
......@@ -440,14 +441,14 @@
NSString *imageName0 = _imageNameArray[(indexPath.row - 3) * 2];
NSString *fullPath0 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName0];
UIImage *image0 = [UIImage imageWithContentsOfFile:fullPath0];
UIImage *image00 = [self cutImage:image0];
UIImage *image00 = [UIImage image:image0 fillSize:CGSizeMake((kScreenWidth - 60) / 2, 90)];
[cell.photoButton1 setImage:image00 forState:UIControlStateNormal];
NSString *imageName1 = _imageNameArray[(indexPath.row - 3) * 2 + 1];
NSLog(@"imageName = %@", imageName1);
NSString *fullPath1 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName1];
UIImage *image1 = [UIImage imageWithContentsOfFile:fullPath1];
UIImage *image11 = [self cutImage:image1];
UIImage *image11 = [UIImage image:image1 fillSize:CGSizeMake((kScreenWidth - 60) / 2, 90)];
[cell.photoButton2 setImage:image11 forState:UIControlStateNormal];
[cell.photoButton1 addTarget:self action:@selector(showPicture:) forControlEvents:UIControlEventTouchUpInside];
......@@ -463,30 +464,6 @@
}
//裁剪图片
- (UIImage *)cutImage:(UIImage*)image
{
//压缩图片
CGSize newSize;
CGImageRef imageRef = nil;
if ((image.size.width / image.size.height) < (((kScreenWidth - 20 * 3) / 2) / 90)) {
newSize.width = image.size.width;
newSize.height = image.size.width * 90 / ((kScreenWidth - 20 * 3) / 2);
imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(0, fabs(image.size.height - newSize.height) / 2, newSize.width, newSize.height));
} else {
newSize.height = image.size.height;
newSize.width = image.size.height * ((kScreenWidth - 20 * 3) / 2) / 90;
imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(fabs(image.size.width - newSize.width) / 2, 0, newSize.width, newSize.height));
}
return [UIImage imageWithCGImage:imageRef];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == 0) {
......
......@@ -21,7 +21,7 @@
#import "NoDataView.h"
#import <MBProgressHUD.h>
#import "UIImage+Fit.h"
#import <MJRefresh.h>
#define kQuestionListCell @"questionListTableViewCell"
......
......@@ -10,7 +10,7 @@
@protocol SOPTableViewDelegate <NSObject>
- (void)selectRowWithDetailTitle:(NSString *)detailTitle;
- (void)selectRowWithDetailRow:(NSInteger )row;
@end
......
......@@ -73,8 +73,8 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (_sop_delegate && [_sop_delegate respondsToSelector:@selector(selectRowWithDetailTitle:)]) {
[_sop_delegate selectRowWithDetailTitle:_titleArray[indexPath.row]];
if (_sop_delegate && [_sop_delegate respondsToSelector:@selector(selectRowWithDetailRow:)]) {
[_sop_delegate selectRowWithDetailRow:indexPath.row];
}
}
......
......@@ -8,6 +8,7 @@
#import "InspectUpLoadFootView.h"
#import <UIImageView+WebCache.h>
#import "UIImage+Fit.h"
@implementation InspectUpLoadFootView
......@@ -48,6 +49,7 @@
imageView.userInteractionEnabled = YES;
NSDictionary *dict = (NSDictionary *)answerAttachments[i];
NSURL *imageUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", kRedStarURL ,dict[@"fileUrl"]]];
//imageView.contentMode = UIViewContentModeScaleAspectFit;
[imageView sd_setImageWithURL:imageUrl placeholderImage:[UIImage imageNamed:@"default_pic"]];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageCilck:)];
[imageView addGestureRecognizer:tap];
......
......@@ -21,6 +21,7 @@
#import "InspectAddCell.h"
#import "InspectPicAddCell.h"
#import "InpectPictureCell.h"
#import "UIImage+Fit.h"
#define kPhotoTag 2221113
......@@ -144,14 +145,15 @@
- (void)saveImage:(UIImage *)currentImage {
NSData *imageData = UIImageJPEGRepresentation(currentImage, 0.5);
NSString *imageName = [NSString stringWithFormat:@"imageName%d", (int)_imageNameArray.count];
NSString *imageName = [CommonFunc md5Data:imageData];
[_imageNameArray addObject:imageName];
// 获取沙盒目录
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
// 将图片写入文件
[imageData writeToFile:fullPath atomically:NO];
imageData = nil;
}
#pragma mark - TableView Delegate/DataSource
......@@ -194,7 +196,7 @@
NSString *imageName = _imageNameArray[_imageNameArray.count - 1];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
UIImage *image00 = [self cutImage:image];
UIImage *image00 = [UIImage image:image fillSize:CGSizeMake((kScreenWidth - 60) / 2, 90)];
[cell.photoButton1 setImage:image00 forState:UIControlStateNormal];
[cell.photoButton1 addTarget:self action:@selector(showPicture:) forControlEvents:UIControlEventTouchUpInside];
......@@ -229,13 +231,13 @@
NSString *imageName0 = _imageNameArray[(indexPath.row - 1) * 2];
NSString *fullPath0 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName0];
UIImage *image0 = [UIImage imageWithContentsOfFile:fullPath0];
UIImage *image00 = [self cutImage:image0];
UIImage *image00 = [UIImage image:image0 fillSize:CGSizeMake((kScreenWidth - 60) / 2, 90)];
[cell.photoButton1 setImage:image00 forState:UIControlStateNormal];
NSString *imageName1 = _imageNameArray[(indexPath.row - 1) * 2 + 1];
NSString *fullPath1 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName1];
UIImage *image1 = [UIImage imageWithContentsOfFile:fullPath1];
UIImage *image11 = [self cutImage:image1];
UIImage *image11 = [UIImage image:image1 fillSize:CGSizeMake((kScreenWidth - 60) / 2, 90)];
[cell.photoButton2 setImage:image11 forState:UIControlStateNormal];
......@@ -250,29 +252,6 @@
}
}
//裁剪图片
- (UIImage *)cutImage:(UIImage*)image
{
//压缩图片
CGSize newSize;
CGImageRef imageRef = nil;
if ((image.size.width / image.size.height) < (((kScreenWidth - 20 * 3) / 2) / 90)) {
newSize.width = image.size.width;
newSize.height = image.size.width * 90 / ((kScreenWidth - 20 * 3) / 2);
imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(0, fabs(image.size.height - newSize.height) / 2, newSize.width, newSize.height));
} else {
newSize.height = image.size.height;
newSize.width = image.size.height * ((kScreenWidth - 20 * 3) / 2) / 90;
imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(fabs(image.size.width - newSize.width) / 2, 0, newSize.width, newSize.height));
}
return [UIImage imageWithCGImage:imageRef];
}
// section高度
......
......@@ -52,7 +52,7 @@
{
_taskDetail = taskDetail;
self.shopNameLabel.text = [NSString stringWithFormat:@"%@", taskDetail.store_name];
self.rankDetailView.addressLabel.text = [NSString stringWithFormat:@"%@", taskDetail.storePath];
// self.rankDetailView.addressLabel.text = [NSString stringWithFormat:@"%@", taskDetail.];
self.rankDetailView.titleLabel.text = [NSString stringWithFormat:@"%@", taskDetail.name];
self.rankDetailView.reportTimeLabel.text = @"上报时间";
self.rankDetailView.totalScoreLabel.text = @"总评分";
......
......@@ -575,7 +575,12 @@
[_rankDetailHeaderView.rankDetailView.gradeLabel setAttributedText:rankAttr];
}
self.rankDetailHeaderView.backgroundColor = kSectionBackGroundColor;
self.rankDetailHeaderView.rankDetailView.addressLabel.text = [NSString stringWithFormat:@"%@", self.storeAddress];
if (self.storeAddress == nil || self.storeAddress == NULL || [self.storeAddress isEqual:[NSNull null]] || self.storeAddress == Nil || [self.storeAddress isEqualToString:@"(null)"]) {
self.rankDetailHeaderView.rankDetailView.addressLabel.text = @"";
} else {
self.rankDetailHeaderView.rankDetailView.addressLabel.text = [NSString stringWithFormat:@"%@", self.storeAddress];
}
self.rankDetailHeaderView.rankDetailView.storePictures = self.storePictures;
}
return _rankDetailHeaderView;
......
......@@ -296,6 +296,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
[questionTempArr addObject:question];
}
_allQuestionArray = questionTempArr;
NSLog(@"111quesssssssss.count === %ld", _allQuestionArray.count);
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
......@@ -368,7 +369,6 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
{
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL];
NSLog(@"uuuurl = %@", url);
HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url];
......@@ -378,18 +378,20 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
@"pageNumber":@(0),
@"pageSize":@(2)
};
NSLog(@"parrrrr = %@", parameters);
[httpCilent getInspectListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"巡检列表%@", response);
NSLog(@"error = %@", error);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in dataArray) {
TaskListModel *taskList = [[TaskListModel alloc] init];
[taskList setValuesForKeysWithDictionary:dict];
[_taskListDataArray addObject:taskList];
[tempArray addObject:taskList];
}
_taskListDataArray = [NSMutableArray arrayWithArray:tempArray];
if (_taskListDataArray.count != 0) {
[_sectionArray addObject:@"口碑巡检"];
}
......@@ -414,8 +416,6 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
};
// 发起请求
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:urlStr];
//
__block HomeViewController *weakSelf = self;
// 请求问题列表
[httpClient getQuestionListWithParameters:parameters completion:^(id response, NSError *error) {
......@@ -426,11 +426,13 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
NSDictionary *recordsDict = (NSDictionary *)dataDict[@"records"];
NSLog(@"问题与知识列表recods = %@", response);
NSLog(@"error = %@", error);
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *questionDict in recordsDict) {
QuestionModel *question = [[QuestionModel alloc] init];
[question setValuesForKeysWithDictionary:questionDict];
[weakSelf.allQuestionArray addObject:question];
[tempArray addObject:question];
}
_allQuestionArray = [NSMutableArray arrayWithArray:tempArray];
if (_allQuestionArray.count != 0) {
[_sectionArray addObject:@"问题知识"];
}
......@@ -461,10 +463,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
// 请求问题列表
[httpClient queryPicturePraiseWithParameters:parameters completion:^(id response, NSError *error) {
[self requestQuestionList];
NSLog(@"图说口碑 response = %@ error = %@" , response, error);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
......@@ -473,7 +472,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
[picList setValuesForKeysWithDictionary:dict];
[tempArray addObject:picList];
}
_allPraiseListArray = tempArray;
_allPraiseListArray = [NSMutableArray arrayWithArray:tempArray];
if (_allPraiseListArray.count != 0) {
[_sectionArray addObject:@"商场风采"];
}
......@@ -670,9 +669,18 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
if (!cell) {
cell = [[RankingListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeRankingListCell];
}
for (int i = 0 ; i < _allRankListArray.count; i++) {
RankListModel *rank = _allRankListArray[i];
if (i == 0) {
rank.index = i + 1;
} else {
RankListModel *prevRank = _allRankListArray[i-1];
rank.index = rank.score == prevRank.score ? prevRank.index: i + 1;
}
}
RankListModel *rankList = _allRankListArray[indexPath.row - 1];
cell.rankList = rankList;
cell.gradeImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"medal_0%d", rankList.index+ 1]];
cell.gradeImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"medal_0%d", rankList.index]];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
......
......@@ -78,13 +78,13 @@
NSDictionary *dict = response[@"data"];
NSString *newVersion = [NSString stringWithFormat:@"%@", dict[@"version"]];
self.jumpURL = [NSString stringWithFormat:@"%@", dict[@"url"]];
NSLog(@"newVersion = %@, _jumpURL = %@", newVersion, _jumpURL);
[self checkAppUpdate:newVersion forceUpdate:[NSString stringWithFormat:@"%@", dict[@"forceUpdate"]]];
BOOL isForce = [dict[@"forceUpdate"] boolValue];
[self checkAppUpdate:newVersion forceUpdate:isForce];
}
}];
}
- (void)checkAppUpdate:(NSString *)newVersion forceUpdate:(NSString *)forceUpdate
- (void)checkAppUpdate:(NSString *)newVersion forceUpdate:(BOOL)forceUpdate
{
// 获取当前版本
NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
......@@ -93,7 +93,7 @@
if (![currentVersion isEqualToString:newVersion]) {
if ([forceUpdate isEqualToString:@"1"]) {
if (forceUpdate) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示!" message:[NSString stringWithFormat:@"发现新版本:%@,如果不更新,可能造成本应用无法使用!", newVersion] delegate:self cancelButtonTitle:nil otherButtonTitles:@"前往更新", nil];
alert.delegate = self;
alert.tag = 322234;
......@@ -107,7 +107,7 @@
}
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (alertView.tag == 3058284) {
if (buttonIndex == 1) {
......
......@@ -120,6 +120,11 @@
[self.tabBarController dismissViewControllerAnimated:YES completion:nil];
}
}
if (buttonIndex == 1 && alertView.tag == 3058284) {
NSString *url = self.jumpURL;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}
}
#pragma mark - Private Methods
......@@ -159,14 +164,6 @@
}
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 1 && alertView.tag == 3058284) {
NSString *url = self.jumpURL;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}
}
#pragma mark - TableView Delegate/DataSource
......@@ -198,7 +195,7 @@
AboutMeViewController *about = [[AboutMeViewController alloc] init];
[self.navigationController pushViewController:about animated:YES];
} else {
self.numberActionSheet = [[UIActionSheet alloc] initWithTitle:@"请求数量" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"10",@"20",@"30",@"40", @"50", nil];
self.numberActionSheet = [[UIActionSheet alloc] initWithTitle:@"列表请求数量设置" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"10",@"20",@"30",@"40", @"50", nil];
[_numberActionSheet showInView:self.view];
}
......
//
// UIImage+Fit.h
// redstar
//
// Created by admin on 15/12/28.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImage (Fit)
//计算适合的大小。并保留其原始图片大小
+ (CGSize)fitSize:(CGSize)thisSize inSize:(CGSize)aSize;
// 返回调整的缩略图
+ (UIImage *)image:(UIImage *)image fitInSize:(CGSize)viewsize;
//返回居中的缩略图
+ (UIImage *)image:(UIImage *)image centerInSize:(CGSize)viewsize;
// 返回填充的缩略图
+ (UIImage *)image:(UIImage *)image fillSize:(CGSize)viewsize;
@end
//
// UIImage+Fit.m
// redstar
//
// Created by admin on 15/12/28.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "UIImage+Fit.h"
@implementation UIImage (Fit)
//计算适合的大小。并保留其原始图片大小
+ (CGSize) fitSize: (CGSize)thisSize inSize: (CGSize) aSize
{
CGFloat scale;
CGSize newsize = thisSize;
if (newsize.height && (newsize.height > aSize.height))
{
scale = aSize.height / newsize.height;
newsize.width *= scale;
newsize.height *= scale;
}
if (newsize.width && (newsize.width >= aSize.width))
{
scale = aSize.width / newsize.width;
newsize.width *= scale;
newsize.height *= scale;
}
return newsize;
}
// 返回调整的缩略图
+ (UIImage *) image: (UIImage *) image fitInSize: (CGSize) viewsize
{
// calculate the fitted size
CGSize size = [self fitSize:image.size inSize:viewsize];
UIGraphicsBeginImageContext(viewsize);
float dwidth = (viewsize.width - size.width) / 2.0f;
float dheight = (viewsize.height - size.height) / 2.0f;
CGRect rect = CGRectMake(dwidth, dheight, size.width, size.height);
[image drawInRect:rect];
UIImage *newimg = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newimg;
}
//返回居中的缩略图
+ (UIImage *) image: (UIImage *) image centerInSize: (CGSize) viewsize {
CGSize size = image.size;
UIGraphicsBeginImageContext(viewsize);
float dwidth = (viewsize.width - size.width) / 2.0f;
float dheight = (viewsize.height - size.height) / 2.0f;
CGRect rect = CGRectMake(dwidth, dheight, size.width, size.height);
[image drawInRect:rect];
UIImage *newimg = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newimg;
}
// 返回填充的缩略图
+ (UIImage *) image: (UIImage *) image fillSize: (CGSize) viewsize {
CGSize size = image.size;
CGFloat scalex = viewsize.width / size.width;
CGFloat scaley = viewsize.height / size.height;
CGFloat scale = MAX(scalex, scaley);
UIGraphicsBeginImageContext(viewsize);
CGFloat width = size.width * scale;
CGFloat height = size.height * scale;
float dwidth = ((viewsize.width - width) / 2.0f);
float dheight = ((viewsize.height - height) / 2.0f);
CGRect rect = CGRectMake(dwidth, dheight, size.width * scale, size.height * scale);
[image drawInRect:rect];
UIImage *newimg = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newimg;
}
@end
......@@ -41,9 +41,11 @@
UIButton *button = [[UIButton alloc] init];
button.tag = kBtnTag + i;
button.titleLabel.font = [UIFont systemFontOfSize:15.0];
button.titleLabel.numberOfLines = 0;
[button setTitleColor:kLightBlack forState:UIControlStateNormal];
button.frame = CGRectMake(0, i * buttonHeight, kSelfWidth, buttonHeight);
[button setTitle:item.title forState:UIControlStateNormal];
button.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 5);
[button addTarget:self action:@selector(touchDownForButton:) forControlEvents:UIControlEventTouchDown];
[button addTarget:self action:@selector(touchUpForButton:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:button];
......
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