Commit 6762b7ed authored by 管鹏飞's avatar 管鹏飞

『修改行情反馈』界面及『图片预览』bug修复、性能优化 Sandy

parent efffd68d
...@@ -211,6 +211,7 @@ ...@@ -211,6 +211,7 @@
72F9D4881BA8065500795A00 /* PurchaseNoticeListCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F9D4871BA8065500795A00 /* PurchaseNoticeListCell.m */; }; 72F9D4881BA8065500795A00 /* PurchaseNoticeListCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F9D4871BA8065500795A00 /* PurchaseNoticeListCell.m */; };
72F9D48B1BA8582100795A00 /* NoticeBoltView.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F9D48A1BA8582100795A00 /* NoticeBoltView.m */; }; 72F9D48B1BA8582100795A00 /* NoticeBoltView.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F9D48A1BA8582100795A00 /* NoticeBoltView.m */; };
871F9F047CDDAC523E4358DC /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 86D33EC280C440156ED1B976 /* libPods.a */; }; 871F9F047CDDAC523E4358DC /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 86D33EC280C440156ED1B976 /* libPods.a */; };
ABFA26061C87D38800274481 /* JavenImages.m in Sources */ = {isa = PBXBuildFile; fileRef = ABFA26051C87D38800274481 /* JavenImages.m */; };
C10214CD1AD8FE200024637E /* ICRStoreDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C10214CC1AD8FE200024637E /* ICRStoreDetailViewController.m */; }; C10214CD1AD8FE200024637E /* ICRStoreDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C10214CC1AD8FE200024637E /* ICRStoreDetailViewController.m */; };
C10214CE1AD8FE200024637E /* ICRStoreDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C10214CC1AD8FE200024637E /* ICRStoreDetailViewController.m */; }; C10214CE1AD8FE200024637E /* ICRStoreDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C10214CC1AD8FE200024637E /* ICRStoreDetailViewController.m */; };
C10214D21AD904F30024637E /* ICRPatrolPlanViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C10214D11AD904F30024637E /* ICRPatrolPlanViewController.m */; }; C10214D21AD904F30024637E /* ICRPatrolPlanViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C10214D11AD904F30024637E /* ICRPatrolPlanViewController.m */; };
...@@ -871,6 +872,8 @@ ...@@ -871,6 +872,8 @@
72F9D48A1BA8582100795A00 /* NoticeBoltView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NoticeBoltView.m; sourceTree = "<group>"; }; 72F9D48A1BA8582100795A00 /* NoticeBoltView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NoticeBoltView.m; sourceTree = "<group>"; };
7DDFB1D460448C3B45118195 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; }; 7DDFB1D460448C3B45118195 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
86D33EC280C440156ED1B976 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 86D33EC280C440156ED1B976 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
ABFA26041C87D38800274481 /* JavenImages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavenImages.h; sourceTree = "<group>"; };
ABFA26051C87D38800274481 /* JavenImages.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JavenImages.m; sourceTree = "<group>"; };
C10214CB1AD8FE200024637E /* ICRStoreDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ICRStoreDetailViewController.h; sourceTree = "<group>"; }; C10214CB1AD8FE200024637E /* ICRStoreDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ICRStoreDetailViewController.h; sourceTree = "<group>"; };
C10214CC1AD8FE200024637E /* ICRStoreDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ICRStoreDetailViewController.m; sourceTree = "<group>"; }; C10214CC1AD8FE200024637E /* ICRStoreDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ICRStoreDetailViewController.m; sourceTree = "<group>"; };
C10214D01AD904F30024637E /* ICRPatrolPlanViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ICRPatrolPlanViewController.h; sourceTree = "<group>"; }; C10214D01AD904F30024637E /* ICRPatrolPlanViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ICRPatrolPlanViewController.h; sourceTree = "<group>"; };
...@@ -1437,6 +1440,8 @@ ...@@ -1437,6 +1440,8 @@
359788621C868EB8009205AA /* XFDB.m */, 359788621C868EB8009205AA /* XFDB.m */,
359788631C868EB8009205AA /* XFPhoto.h */, 359788631C868EB8009205AA /* XFPhoto.h */,
359788641C868EB8009205AA /* XFPhoto.m */, 359788641C868EB8009205AA /* XFPhoto.m */,
ABFA26041C87D38800274481 /* JavenImages.h */,
ABFA26051C87D38800274481 /* JavenImages.m */,
); );
path = FeedBack; path = FeedBack;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -3121,6 +3126,7 @@ ...@@ -3121,6 +3126,7 @@
C18AEA961AD1425D00A1DB7B /* ICRDataBaseController.m in Sources */, C18AEA961AD1425D00A1DB7B /* ICRDataBaseController.m in Sources */,
C1E9F5781B2E440A00BF1356 /* JTRecordView.m in Sources */, C1E9F5781B2E440A00BF1356 /* JTRecordView.m in Sources */,
724171711B9D30660094DF55 /* ChooseVendorViewController.m in Sources */, 724171711B9D30660094DF55 /* ChooseVendorViewController.m in Sources */,
ABFA26061C87D38800274481 /* JavenImages.m in Sources */,
7217E9F31B72364300FE5C1D /* SurveyCell.m in Sources */, 7217E9F31B72364300FE5C1D /* SurveyCell.m in Sources */,
C112BC511AD971C500F75F58 /* ICRTaskItemView.m in Sources */, C112BC511AD971C500F75F58 /* ICRTaskItemView.m in Sources */,
7217E9EE1B72364300FE5C1D /* MaskCell.m in Sources */, 7217E9EE1B72364300FE5C1D /* MaskCell.m in Sources */,
...@@ -3451,7 +3457,7 @@ ...@@ -3451,7 +3457,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Shanghai Gomore Information Technology Co.,Ltd"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99; GCC_C_LANGUAGE_STANDARD = gnu99;
...@@ -3496,7 +3502,7 @@ ...@@ -3496,7 +3502,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Shanghai Gomore Information Technology Co.,Ltd"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Fanfan Cui (7S27LB84E2)";
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
ENABLE_NS_ASSERTIONS = NO; ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
...@@ -3548,7 +3554,7 @@ ...@@ -3548,7 +3554,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Fanfan Cui (7S27LB84E2)";
COPYING_PRESERVES_HFS_DATA = NO; COPYING_PRESERVES_HFS_DATA = NO;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
GCC_PREFIX_HEADER = "XFFruit/XFFruit-Prefix.pch"; GCC_PREFIX_HEADER = "XFFruit/XFFruit-Prefix.pch";
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#import "Warehouse.h" #import "Warehouse.h"
#import "Accounttitle.h" #import "Accounttitle.h"
#import "UserWarehouse.h" #import "UserWarehouse.h"
#import "JavenImages.h"
......
//
// JavenImages.h
// XFFruit
//
// Created by Jonathan on 16/3/3.
// Copyright © 2016年 Xummer. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface JavenImages : NSObject
@property (nonatomic, strong) NSMutableArray *imageArr;
+ (instancetype)shareInstance;
- (void)insertImages:(NSArray *)array;
- (void)insertAImage:(UIImage *)image;
- (void)removeAllImage;
@end
//
// JavenImages.m
// XFFruit
//
// Created by Jonathan on 16/3/3.
// Copyright © 2016年 Xummer. All rights reserved.
//
#import "JavenImages.h"
@implementation JavenImages
static JavenImages *_instance;
+ (instancetype)shareInstance
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_instance = [[JavenImages alloc] init];
_instance.imageArr = [NSMutableArray array];
});
return _instance;
}
- (void)insertImages:(NSArray *)array {
for (UIImage *image in array) {
[_instance.imageArr addObject:image];
}
}
- (void)insertAImage:(UIImage *)image {
[_instance.imageArr addObject:image];
}
- (void)removeAllImage {
[_instance.imageArr removeAllObjects];
}
@end
...@@ -55,21 +55,22 @@ static HGPhWViewController *_instance = nil; ...@@ -55,21 +55,22 @@ static HGPhWViewController *_instance = nil;
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
self.title = @"图片预览"; self.title = @"图片预览";
[self initHGPhW]; //[self initHGPhW];
[self initData]; [self initData];
self.imgesMuArr = [NSMutableArray array];
} }
- (void)viewDidDisappear:(BOOL)animated { - (void)viewDidDisappear:(BOOL)animated {
[[NSNotificationCenter defaultCenter] postNotificationName:kimgsFiles object:self]; [[NSNotificationCenter defaultCenter] postNotificationName:kimgsFiles object:self];
} }
- (void)initData { - (void)initData {
self.imgesMuArr = [NSMutableArray array]; // self.imgesMuArr = [NSMutableArray array];
// self.allImgsMuArr = [NSMutableArray array]; //// self.allImgsMuArr = [NSMutableArray array];
// self.allImgAssets = [NSMutableArray array]; //// self.allImgAssets = [NSMutableArray array];
NSArray *arrData = [[XFDB sharedInstance]fetchAllPhotosFromLocal]; // NSArray *arrData = [[XFDB sharedInstance]fetchAllPhotosFromLocal];
for (int count = 0; count < arrData.count; count ++) { // for (int count = 0; count < arrData.count; count ++) {
XFPhoto *xfphoto = arrData[count]; // XFPhoto *xfphoto = arrData[count];
[self addOnePhoto:[UIImage imageWithData:xfphoto.photoData]]; // [self addOnePhoto:[UIImage imageWithData:xfphoto.photoData]];
} // }
} }
- (void)initHGPhW { - (void)initHGPhW {
self.edgesForExtendedLayout = NO; self.edgesForExtendedLayout = NO;
...@@ -94,7 +95,7 @@ static HGPhWViewController *_instance = nil; ...@@ -94,7 +95,7 @@ static HGPhWViewController *_instance = nil;
_photoWall.delegate = self; _photoWall.delegate = self;
#pragma 初始化原来的图片数据 从数据库中读出 #pragma 初始化原来的图片数据 从数据库中读出
[_photoWall setPhotos:nil];// [_photoWall setPhotos:[JavenImages shareInstance].imageArr];//
// @"http://www.weiphone.com/images_v3/logo.png",nil]]; // @"http://www.weiphone.com/images_v3/logo.png",nil]];
[_photoWall setEditModel:YES]; [_photoWall setEditModel:YES];
...@@ -232,24 +233,25 @@ static HGPhWViewController *_instance = nil; ...@@ -232,24 +233,25 @@ static HGPhWViewController *_instance = nil;
UIImage *img = [info objectForKey:UIImagePickerControllerOriginalImage]; UIImage *img = [info objectForKey:UIImagePickerControllerOriginalImage];
[self addOnePhoto:img]; [self addOnePhoto:img];
NSData *imgData = UIImagePNGRepresentation(img); // NSData *imgData = UIImagePNGRepresentation(img);
[self savePhotoToDB:imgData]; // [self savePhotoToDB:imgData];
// [self.allImgsMuArr addObject:imgData]; // [self.allImgsMuArr addObject:imgData];
[[JavenImages shareInstance] insertAImage:img];
[self scrollViewContentHeight]; [self scrollViewContentHeight];
[picker DismissModalViewControllerAnimated:YES]; [picker DismissModalViewControllerAnimated:YES];
} }
#pragma 把选择的图片放入到本地数据库中 #pragma 把选择的图片放入到本地数据库中
- (void)savePhotoToDB: (NSData *)imgData { - (void)savePhotoToDB: (NSData *)imgData {
XFPhoto *xfphoto = [[XFPhoto alloc]initWithPhotoData:imgData]; // XFPhoto *xfphoto = [[XFPhoto alloc]initWithPhotoData:imgData];
BOOL isSave = [[XFDB sharedInstance]savePhoto:xfphoto]; // BOOL isSave = [[setImage sharedInstance]savePhoto:xfphoto];
if (isSave) { // if (isSave) {
NSLog(@"保存成功"); // NSLog(@"保存成功");
} else { // } else {
NSLog(@"保存失败"); // NSLog(@"保存失败");
} // }
} }
#pragma mark - ZYQAssetPickerController Delegate #pragma mark - ZYQAssetPickerController Delegate
-(void)assetPickerController:(ZYQAssetPickerController *)picker didFinishPickingAssets:(NSArray *)assets{ -(void)assetPickerController:(ZYQAssetPickerController *)picker didFinishPickingAssets:(NSArray *)assets{
...@@ -259,19 +261,18 @@ static HGPhWViewController *_instance = nil; ...@@ -259,19 +261,18 @@ static HGPhWViewController *_instance = nil;
[_imgesMuArr removeAllObjects]; [_imgesMuArr removeAllObjects];
} }
// dispatch_async(dispatch_get_global_queue(0, 0), ^{
for (int i=0; i<assets.count; i++) { for (int i=0; i<assets.count; i++) {
ALAsset *asset = assets[i]; ALAsset *asset = assets[i];
CGImageRef ref = [[asset defaultRepresentation]fullResolutionImage]; CGImageRef ref = [[asset defaultRepresentation]fullResolutionImage];
UIImage *img = [[UIImage alloc]initWithCGImage:ref]; UIImage *img = [[UIImage alloc]initWithCGImage:ref];
NSData *imgData = UIImagePNGRepresentation(img);
[self savePhotoToDB:imgData]; [self.imgesMuArr addObject: img];//[UIImage imageNamed:@"AttachCamera"]
// UIImage *tempImg = [UIImage imageWithCGImage:[asset po]];
[self.imgesMuArr addObject: img];//[UIImage imageNamed:@"AttachCamera"] }
// [self.allImgsMuArr addObject:imgData]; [[JavenImages shareInstance] insertImages:_imgesMuArr];
} [self addPhotosWithArrayImgs:_imgesMuArr];
[self addPhotosWithArrayImgs:_imgesMuArr];
// });
[self scrollViewContentHeight]; [self scrollViewContentHeight];
[picker popoverPresentationController]; [picker popoverPresentationController];
...@@ -279,7 +280,7 @@ static HGPhWViewController *_instance = nil; ...@@ -279,7 +280,7 @@ static HGPhWViewController *_instance = nil;
#pragma 调整scrollView内容视图内容高度 #pragma 调整scrollView内容视图内容高度
- (void)scrollViewContentHeight { - (void)scrollViewContentHeight {
NSArray *arr = [[XFDB sharedInstance] fetchAllPhotosFromLocal]; NSArray *arr = [JavenImages shareInstance].imageArr;
NSInteger count = 1; NSInteger count = 1;
if ((arr.count + 1) % kImagCount) { if ((arr.count + 1) % kImagCount) {
count += (arr.count + 1) / kImagCount + 1; count += (arr.count + 1) / kImagCount + 1;
...@@ -290,6 +291,12 @@ static HGPhWViewController *_instance = nil; ...@@ -290,6 +291,12 @@ static HGPhWViewController *_instance = nil;
self.scrollV.contentSize = _photoWall.size; self.scrollV.contentSize = _photoWall.size;
} }
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.view removeAllSubViews];
[self initHGPhW];
}
#pragma 确定选择的照片 #pragma 确定选择的照片
- (void)surePhoto { - (void)surePhoto {
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
CGFloat originy = [[dictionaryTemp objectForKey:kImagePositiony] floatValue]; CGFloat originy = [[dictionaryTemp objectForKey:kImagePositiony] floatValue];
HGPhoto *photoTemp = [[HGPhoto alloc]initWithOrigin:CGPointMake(originx, originy) andLength:kImagWH];//[[HGPhoto alloc] initWithOrigin:CGPointMake(originx, originy)]; HGPhoto *photoTemp = [[HGPhoto alloc]initWithOrigin:CGPointMake(originx, originy) andLength:kImagWH];//[[HGPhoto alloc] initWithOrigin:CGPointMake(originx, originy)];
photoTemp.delegate = self; photoTemp.delegate = self;
[photoTemp setPhotoUrl:[photos objectAtIndex:i]]; [photoTemp setPhotoImg:[photos objectAtIndex:i]];
[self addSubview:photoTemp]; [self addSubview:photoTemp];
[self.arrayPhotos addObject:photoTemp]; [self.arrayPhotos addObject:photoTemp];
} }
...@@ -141,9 +141,7 @@ ...@@ -141,9 +141,7 @@
x = kPadding * (col + 1) + kImagCount * col; x = kPadding * (col + 1) + kImagCount * col;
y = 15.0 / 568 * self.height + kImagWH * row + row * kPadding ; y = 15.0 / 568 * self.height + kImagWH * row + row * kPadding ;
[self.arrayPositions addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"%f",x],kImagePositionx,[NSString stringWithFormat:@"%f",y],kImagePositiony, nil] ]; [self.arrayPositions addObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:@"%f",x],kImagePositionx,[NSString stringWithFormat:@"%f",y],kImagePositiony, nil] ];
// if (_arrayPositions.count % 4 ) {
// <#statements#>
// }
NSUInteger index = [self.arrayPhotos count] - 1; NSUInteger index = [self.arrayPhotos count] - 1;
NSDictionary *dictionaryTemp = [self.arrayPositions objectAtIndex:index ]; NSDictionary *dictionaryTemp = [self.arrayPositions objectAtIndex:index ];
CGFloat originx = [[dictionaryTemp objectForKey:kImagePositionx] floatValue]; CGFloat originx = [[dictionaryTemp objectForKey:kImagePositionx] floatValue];
...@@ -273,6 +271,7 @@ ...@@ -273,6 +271,7 @@
} else { } else {
count = [self.arrayPhotos count] - 1; count = [self.arrayPhotos count] - 1;
} }
for (int i=0; i<count; i++) { for (int i=0; i<count; i++) {
NSDictionary *dictionaryTemp = [self.arrayPositions objectAtIndex:i]; NSDictionary *dictionaryTemp = [self.arrayPositions objectAtIndex:i];
CGFloat originx = [[dictionaryTemp objectForKey:kImagePositionx] floatValue]; CGFloat originx = [[dictionaryTemp objectForKey:kImagePositionx] floatValue];
......
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