Commit 4cd76b1f authored by admin's avatar admin

修复bug

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