Commit 02b8c8df authored by freecui's avatar freecui

添加行情反馈文件

parent afb03654
This diff is collapsed.
......@@ -231,7 +231,11 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
success:(void (^)(id))succ
failure:(void (^)(id))fail;
// 新增行情反馈(写)
- (void)surveySaveResultWithDict: (NSDictionary *)dict
surveyUuid: (NSString *)surveyUuid
success: (void (^)(id))succ
failure: (void (^)(id))fail;
//1.7 商品单位
- (void)getProductunitWithPage_number:(NSUInteger)page_number
page_size:(NSUInteger)page_size
......
......@@ -1772,6 +1772,40 @@ acceptTypeJson:YES
}
}
// 新增行情反馈(写)
- (void)surveySaveResultWithDict: (NSDictionary *)dict surveyUuid:(NSString *)surveyUuid success:(void (^)(id))succ failure:(void (^)(id))fail {
if (!dict || !surveyUuid) {
if (fail) {
fail( [[self class] ErrorWithMsg:ERROR_PARAMETER code:0] );
}
return;
}
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSString *currentTime = [[NSDate date] httpParameterString];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_SurveyFinish] stringByAppendingFormat:@"/?survey_uuid=%@&time=%@&operId=%@&operName=%@",surveyUuid,currentTime,userUtil.userId,userUtil.displayName];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr
parameters:dict
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
......
//
// HGPhWViewController.h
// Cruiser
// 图片预览
// Created by freecui on 15/7/24.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTUIViewController.h"
#define kimgsFiles @"uploadImgsFiles"
@class HGPhotoWall;
@interface HGPhWViewController : IBTUIViewController
@property (strong, nonatomic)HGPhotoWall *photoWall;
@property (strong, nonatomic)NSString *url;
@property (strong, nonatomic) UIImage *img;
//@property (strong, nonatomic) NSMutableArray *phontosChooceMuArr;
//@property (strong, nonatomic) NSMutableArray *allImgsMuArr;//全部的照片的data数据
//@property (strong, nonatomic) NSMutableArray *allImgAssets;
+ (instancetype) shareInstance;
- (void)addOnePhoto: (UIImage *)img ;
- (void)addPhotosWithArrayImgs: (NSArray *)arr ;
@end
//
// HGPhWViewController.m
// Cruiser
// 图片预览
// Created by freecui on 15/7/24.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "HGPhWViewController.h"
#import "HGPhotoWall.h"
#import "HGPhoto.h"
#import "ZYQAssetPickerController.h"
#import "XFDB.h"
#import "XFPhoto.h"
@interface HGPhWViewController ()<HGPhotoWallDelegate,UIActionSheetDelegate,ZYQAssetPickerControllerDelegate,UINavigationControllerDelegate,UIScrollViewDelegate,UIImagePickerControllerDelegate>
@property (strong, nonatomic) UIView *coverV;
@property (strong, nonatomic) NSMutableArray *imgesMuArr;//每次从相册中选择的照片
//@property (strong, nonatomic) NSMutableArray *allImgsMuArr;
@property (strong, nonatomic) IBTUIButton *sureBtn;
@property (strong, nonatomic) UIScrollView *scrollV;
#define kImagCount 3
#define kPadding (20.0 / 320.0 * self.view.width)/(kImagCount + 1)
#define kImagWH ((self.view.width - (kImagCount + 1.0) * kPadding) / kImagCount)
#define KpaddingPhonto kPadding + kImagWH
@end
@implementation HGPhWViewController
static HGPhWViewController *_instance = nil;
+ (instancetype) shareInstance {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_instance = [[self alloc]init];
});
return _instance;
}
// 重写init方法
- (id)init {
self = [super init];
if (!self) {
return nil;
}
//self.photoWall = [[HGPhotoWall alloc]init];
// [self initHGPhW];
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.title = @"图片预览";
[self initHGPhW];
[self initData];
}
- (void)viewDidDisappear:(BOOL)animated {
[[NSNotificationCenter defaultCenter] postNotificationName:kimgsFiles object:self];
}
- (void)initData {
self.imgesMuArr = [NSMutableArray array];
// self.allImgsMuArr = [NSMutableArray array];
// self.allImgAssets = [NSMutableArray array];
NSArray *arrData = [[XFDB sharedInstance]fetchAllPhotosFromLocal];
for (int count = 0; count < arrData.count; count ++) {
XFPhoto *xfphoto = arrData[count];
[self addOnePhoto:[UIImage imageWithData:xfphoto.photoData]];
}
}
- (void)initHGPhW {
self.edgesForExtendedLayout = NO;
// self.sureBtn = [IBTUIButton RoundCornerBtnWithTitle:@"确定上传图片" bgColor:nil];
// _sureBtn.frame = CGRectMake(10, self.view.height - 50 - 64, self.view.width - 20, 40);
// [_sureBtn addTarget:self action:@selector(surePhoto) forControlEvents:UIControlEventTouchUpInside];
// [_sureBtn setBackgroundColor:[UIColor redColor]];
// [self.view addSubview:_sureBtn];
self.scrollV = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, self.view.width, self.view.height)];
[self.view addSubview:_scrollV];
self.photoWall = [[HGPhotoWall alloc]init];
_photoWall.backgroundColor = [UIColor yellowColor];
_photoWall.frame = (CGRect) {
.origin.x = 0,
.origin.y = 0,
.size.width = self.view.width,
.size.height = self.scrollV.height
};//self.view.bounds;
_photoWall.delegate = self;
#pragma 初始化原来的图片数据 从数据库中读出
[_photoWall setPhotos:nil];//
// @"http://www.weiphone.com/images_v3/logo.png",nil]];
[_photoWall setEditModel:YES];
//[self.view addSubview:_photoWall];
_scrollV.contentSize = _photoWall.size;
[_scrollV addSubview:_photoWall];
[self scrollViewContentHeight];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark -
#pragma mark 点击图片并放大
//- (void)photoWallPhotoTaped:(NSUInteger)index
//{
- (void)photoWallPhotoTaped:(HGPhoto*)hgPhoto {
[hgPhoto showImage];
// UIImageView *imgV = [[UIImageView alloc]init];
// imgV.frame = _coverV.bounds;
// [imgV setImageWithURL:self.photoWall]
// UIActionSheet *actionSheetTemp = [[UIActionSheet alloc] initWithTitle:nil
// delegate:self
// cancelButtonTitle:@"取消"
// destructiveButtonTitle:@"删除图片"
// otherButtonTitles:nil, nil];
// [actionSheetTemp showInView:self.view];
}
- (void)photoWallPhotoDel:(NSUInteger)index {
[_photoWall deletePhotoByIndex:index];
}
- (void)delCoverV {
if (_coverV) {
[_coverV removeFromSuperview];
}
}
- (void)photoWallMovePhotoFromIndex:(NSInteger)index toIndex:(NSInteger)newIndex
{
}
- (void)photoWallAddAction
{
// [self.photoWall addPhoto:_url];
// [self.photoWall addPhoto:@"http://cc.cocimg.com/bbs/attachment/upload/92/1226921340986127.jpg"];
[self.photoWall addPhotoImg:_img];
}
- (void)photoWallAddFinish
{
}
- (void)photoWallDeleteFinish
{
}
#pragma 增加一张照片
- (void)addOnePhoto: (UIImage *)img {
// [self.photoWall addPhoto:@"http://cc.cocimg.com/bbs/attachment/upload/92/1226921340986127.jpg"];
self.img = img;
[self.photoWall addPhotoImg:img];
NSLog(@"%@",NSStringFromCGRect(_photoWall.frame));
}
#pragma 增加多张照片
- (void)addPhotosWithArrayImgs:(NSArray *)arr {
for(UIImage *img in arr){
[self addOnePhoto:img];
}
}
#pragma 照片选择
- (void)photowallChoosePhontoes {
UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"打开照相机", @"从手机相册获取", nil];
[actionSheet showInView:self.view];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
switch (buttonIndex) {
case 0:
[self openCamera];
break;
case 1:
[self libraryPhoto];
break;
default:
break;
}
}
- (void)openCamera {
UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera;
UIImagePickerController *picker = [[UIImagePickerController alloc]init];
picker.delegate = self;
picker.allowsEditing = NO;
picker.sourceType = sourceType;
[self PresentModalViewController:picker animated:YES];
}
- (void)libraryPhoto {
ZYQAssetPickerController *assetPicker = [[ZYQAssetPickerController alloc]init];
assetPicker.maximumNumberOfSelection = 10;
assetPicker.assetsFilter = [ALAssetsFilter allPhotos];
assetPicker.showEmptyGroups = NO;
assetPicker.delegate = self;
// assetPicker.indexPathsForSelectedItems = _allImgAssets;
assetPicker.selectionFilter = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
if ([[(ALAsset *)evaluatedObject valueForProperty:ALAssetPropertyType] isEqual:ALAssetTypeVideo]) {
NSTimeInterval duration = [[(ALAsset *)evaluatedObject valueForProperty:ALAssetPropertyDuration] doubleValue];
return duration >= 5;
} else {
return YES;
}
}];
[self PresentModalViewController:assetPicker animated:YES];
}
#pragma UIImagePickerControllerDelegate
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *img = [info objectForKey:UIImagePickerControllerOriginalImage];
[self addOnePhoto:img];
NSData *imgData = UIImagePNGRepresentation(img);
[self savePhotoToDB:imgData];
// [self.allImgsMuArr addObject:imgData];
[self scrollViewContentHeight];
[picker DismissModalViewControllerAnimated:YES];
}
#pragma 把选择的图片放入到本地数据库中
- (void)savePhotoToDB: (NSData *)imgData {
XFPhoto *xfphoto = [[XFPhoto alloc]initWithPhotoData:imgData];
BOOL isSave = [[XFDB sharedInstance]savePhoto:xfphoto];
if (isSave) {
NSLog(@"保存成功");
} else {
NSLog(@"保存失败");
}
}
#pragma mark - ZYQAssetPickerController Delegate
-(void)assetPickerController:(ZYQAssetPickerController *)picker didFinishPickingAssets:(NSArray *)assets{
if (_imgesMuArr.count > 0) {
[_imgesMuArr removeAllObjects];
}
// dispatch_async(dispatch_get_global_queue(0, 0), ^{
for (int i=0; i<assets.count; i++) {
ALAsset *asset = assets[i];
CGImageRef ref = [[asset defaultRepresentation]fullResolutionImage];
UIImage *img = [[UIImage alloc]initWithCGImage:ref];
NSData *imgData = UIImagePNGRepresentation(img);
[self savePhotoToDB:imgData];
// UIImage *tempImg = [UIImage imageWithCGImage:[asset po]];
[self.imgesMuArr addObject: img];//[UIImage imageNamed:@"AttachCamera"]
// [self.allImgsMuArr addObject:imgData];
}
[self addPhotosWithArrayImgs:_imgesMuArr];
// });
[self scrollViewContentHeight];
[picker popoverPresentationController];
}
#pragma 调整scrollView内容视图内容高度
- (void)scrollViewContentHeight {
NSArray *arr = [[XFDB sharedInstance] fetchAllPhotosFromLocal];
NSInteger count = 1;
if ((arr.count + 1) % kImagCount) {
count += (arr.count + 1) / kImagCount + 1;
} else {
count += (arr.count + 1) / kImagCount ;
}
self.photoWall.height = 15.0 / 568 * self.view.height + KpaddingPhonto * count;
self.scrollV.contentSize = _photoWall.size;
}
#pragma 确定选择的照片
- (void)surePhoto {
}
@end
//
// Photo.h
// PhotoDemo
//
// Created by Harry on 12-12-6.
// Copyright (c) 2012年 Harry. All rights reserved.
//
#import <UIKit/UIKit.h>
@class HGPhoto;
@protocol HGPhotoDelegate <NSObject>
@optional
- (void)photoTaped:(HGPhoto*)photo;
- (void)photoMoveFinished:(HGPhoto*)photo;
- (void)photoDel : (HGPhoto *)photo;
@end
typedef NS_ENUM(NSInteger, PhotoType) {
PhotoTypePhoto = 0, //Default
PhotoTypeAdd = 1,
};
@interface HGPhoto : UIView
@property (assign) id<HGPhotoDelegate> delegate;
- (id)initWithOrigin:(CGPoint)origin;
- (id)initWithOrigin:(CGPoint)origin andLength: (CGFloat)length;
- (void)setPhotoType:(PhotoType)type;
- (PhotoType)getPhotoType;
- (void)setPhotoUrl:(NSString*)photoUrl;
- (void)setPhotoImg : (UIImage *)img;
- (void)moveToPosition:(CGPoint)point;
- (void)setEditModel:(BOOL)edit;
- (void)showImage;//点击扩大图片
@end
//
// Photo.m
// PhotoDemo
//
// Created by Harry on 12-12-6.
// Copyright (c) 2012年 Harry. All rights reserved.
//
#import "HGPhoto.h"
#import <QuartzCore/QuartzCore.h>
#import "UIImageView+WebCache.h"
static CGRect oldframe;
@interface HGPhoto() <UIGestureRecognizerDelegate>
@property (strong, nonatomic) UIView *viewMask;
@property (strong, nonatomic) UIImageView *viewPhoto;
@property (strong, nonatomic) UIButton *delBtn;
@property (strong, nonatomic) NSString *stringImageUrl;
@property (nonatomic) CGPoint pointOrigin;
@property (nonatomic) BOOL editModel;
@property (nonatomic) PhotoType type;
@end
#define kPhotoSize 100. //75//
@implementation HGPhoto
- (id)initWithOrigin:(CGPoint)origin
{
self = [super initWithFrame:CGRectMake(origin.x, origin.y, kPhotoSize, kPhotoSize)];
if (self) {
self.backgroundColor = [UIColor clearColor];
self.viewPhoto = [[UIImageView alloc] initWithFrame:self.bounds];
self.viewPhoto.layer.cornerRadius = 12;
self.viewPhoto.layer.masksToBounds = YES;
self.delBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_delBtn setBackgroundImage:[UIImage imageNamed:@"attachment_delete_btn"] forState:UIControlStateNormal];
CGFloat btnX = _viewPhoto.frame.size.width * 0.7;
CGFloat btnY = 0;
CGFloat btnW = _viewPhoto.frame.size.width - btnX;
_delBtn.frame = CGRectMake(btnX, btnY, btnW, btnW);
[_delBtn addTarget:self action:@selector(delphoto) forControlEvents:UIControlEventTouchUpInside];
[_viewPhoto addSubview:_delBtn];
self.viewMask = [[UIView alloc] initWithFrame:self.bounds];
self.viewMask.alpha = 0.6;
self.viewMask.backgroundColor = [UIColor blackColor];
self.viewMask.layer.cornerRadius = 11;
self.viewMask.layer.masksToBounds = YES;
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapPress:)];
[self addSubview:self.viewPhoto];
[self addSubview:self.viewMask];
[self addGestureRecognizer:tapRecognizer];
self.editModel = NO;
self.viewMask.hidden = YES;
}
self.autoresizingMask = UIViewContentModeScaleAspectFill;
//self.autoresizingMask = UIViewAutoresizingFlexibleWidth & UIViewAutoresizingFlexibleHeight;
return self;
}
- (id)initWithOrigin:(CGPoint)origin andLength:(CGFloat)length {
self = [self initWithOrigin:origin];
self.viewPhoto.size = CGSizeMake(length, length);
self.size = CGSizeMake(length, length);
return self;
}
- (void)setPhotoType:(PhotoType)type
{
self.type = type;
if (type == PhotoTypeAdd) {
self.viewPhoto.image = [UIImage imageNamed:@"AttachCamera"];//@"addPhoto"];
[_delBtn removeFromSuperview];
}
}
- (PhotoType)getPhotoType
{
return self.type;
}
- (void)setPhotoUrl:(NSString*)photoUrl
{
[self.viewPhoto setImageWithURL:[NSURL URLWithString:photoUrl] placeholderImage:nil];
}
- (void)setPhotoImg:(UIImage *)img {
[self.viewPhoto setImage:img];
}
- (void)moveToPosition:(CGPoint)point
{
if (self.type == PhotoTypePhoto) {
[UIView animateWithDuration:0.5 animations:^{
self.frame = CGRectMake(point.x, point.y, self.frame.size.width, self.frame.size.height);
} completion:nil];
} else {
self.frame = CGRectMake(point.x, point.y, self.frame.size.width, self.frame.size.height);
}
}
- (void)setEditModel:(BOOL)edit
{
if (self.type == PhotoTypePhoto) {
if (edit) {
UILongPressGestureRecognizer *longPressreRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
longPressreRecognizer.delegate = self;
[self addGestureRecognizer:longPressreRecognizer];
} else {
for (UIGestureRecognizer *recognizer in [self gestureRecognizers]) {
if ([recognizer isKindOfClass:[UILongPressGestureRecognizer class]]) {
[self removeGestureRecognizer:recognizer];
break;
}
}
}
}
}
#pragma btn action
- (void)delphoto {
if ([self.delegate respondsToSelector:@selector(photoDel:)]) {
[self.delegate photoDel:self];
}
}
#pragma mark - UITapGestureRecognizer
- (void)tapPress: (UITapGestureRecognizer *)tap//(id)sender
{
//根据点击的位置不同去响应事件
CGMutablePathRef pathRef=CGPathCreateMutable();
CGPathMoveToPoint(pathRef, NULL, _delBtn.frame.origin.x, _delBtn.frame.origin.y);
CGPathAddLineToPoint(pathRef, NULL, _delBtn.frame.origin.x, _delBtn.frame.origin.y);
CGPathAddLineToPoint(pathRef, NULL, _delBtn.frame.origin.x + _delBtn.frame.size.width, _delBtn.frame.origin.y);
CGPathAddLineToPoint(pathRef, NULL, _delBtn.frame.origin.x,_delBtn.frame.origin.y + _delBtn.frame.size.height );
CGPathAddLineToPoint(pathRef, NULL, _delBtn.frame.origin.x + _delBtn.frame.size.width, _delBtn.frame.origin.y + _delBtn.frame.size.height);
CGPathCloseSubpath(pathRef);
CGPoint p = [tap locationInView:self];
if (CGPathContainsPoint(pathRef, NULL, p, NO)) {
NSLog(@"point in path!");
if ([self.delegate respondsToSelector:@selector(photoDel:)]) {
[self.delegate photoDel:self];
}
}
else {
NSLog(@"outPoint out path!");
if ([self.delegate respondsToSelector:@selector(photoTaped:)]) {
[self.delegate photoTaped:self];
}
}
}
- (void)handleLongPress:(id)sender
{
UILongPressGestureRecognizer *recognizer = sender;
CGPoint point = [recognizer locationInView:self];
CGFloat diffx = 0.;
CGFloat diffy = 0.;
if (UIGestureRecognizerStateBegan == recognizer.state) {
self.viewMask.hidden = NO;
self.pointOrigin = point;
[self.superview bringSubviewToFront:self];
} else if (UIGestureRecognizerStateEnded == recognizer.state) {
self.viewMask.hidden = YES;
if ([self.delegate respondsToSelector:@selector(photoMoveFinished:)]) {
[self.delegate photoMoveFinished:self];
}
} else {
diffx = point.x - self.pointOrigin.x;
diffy = point.y - self.pointOrigin.y;
}
CGFloat originx = self.frame.origin.x +diffx;
CGFloat originy = self.frame.origin.y +diffy;
self.frame = CGRectMake(originx, originy, self.frame.size.width, self.frame.size.height);
}
- (void)showImage {
UIImage *image = _viewPhoto.image;
UIWindow *window = [UIApplication sharedApplication].keyWindow;
UIView *backgroundView = [[UIView alloc]init];
backgroundView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
oldframe = [_viewPhoto convertRect:_viewPhoto.bounds toView:window ];
backgroundView.backgroundColor=[UIColor blackColor];
backgroundView.alpha = 0;
UIImageView *imageView = [[UIImageView alloc]init];
imageView.image = image;
imageView.tag = 1;
[backgroundView addSubview:imageView];
[window addSubview:backgroundView];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(hideImage:)];
[backgroundView addGestureRecognizer:tap];
[UIView animateWithDuration:0.3 animations:^{
imageView.frame = CGRectMake(
0,
([UIScreen mainScreen].bounds.size.height-image.size.height*[UIScreen mainScreen].bounds.size.width/image.size.width)/2,
[UIScreen mainScreen].bounds.size.width, image.size.height*[UIScreen mainScreen].bounds.size.width/image.size.width);
backgroundView.alpha = 1;
} completion:^(BOOL finished) {
}];
}
- (void)hideImage : (UITapGestureRecognizer *)tap {
UIView *backgroundView = tap.view;
UIImageView *imageView = (UIImageView *)[tap.view viewWithTag:1];
[UIView animateWithDuration:0.3 animations:^{
imageView.frame = oldframe;
backgroundView.alpha = 0;
} completion:^(BOOL finished) {
[backgroundView removeFromSuperview];
}];
}
@end
//
// HGPhotoWall.h
// PhotoDemo
//
// Created by Harry on 12-12-6.
// Copyright (c) 2012年 Harry. All rights reserved.
//
#import <UIKit/UIKit.h>
@class HGPhoto;
@protocol HGPhotoWallDelegate <NSObject>
- (void)photoWallPhotoDel:(NSUInteger )index; //删除
- (void)photoWallPhotoTaped:(HGPhoto *)hgPhoto; //扩大图片
- (void)photoWallMovePhotoFromIndex:(NSInteger)index toIndex:(NSInteger)newIndex;
- (void)photoWallAddAction;
- (void)photoWallAddFinish;
- (void)photoWallDeleteFinish;
- (void)photowallChoosePhontoes;//从相册或相机中取照片
@end
@interface HGPhotoWall : UIView
@property (assign) id<HGPhotoWallDelegate> delegate;
- (void)setPhotos:(NSArray*)photos;
- (void)setEditModel:(BOOL)canEdit;
- (void)addPhoto:(NSString*)string;
- (void)addPhotoImg: (UIImage *)img;
- (void)deletePhotoByIndex:(NSUInteger)index;
@end
//
// ZYQAssetPickerController.h
// ZYQAssetPickerControllerDemo
//
// Created by Zhao Yiqi on 13-12-25.
// Copyright (c) 2013年 heroims. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <AssetsLibrary/AssetsLibrary.h>
#pragma mark - ZYQAssetPickerController
@protocol ZYQAssetPickerControllerDelegate;
@interface ZYQAssetPickerController : UINavigationController
@property (nonatomic, weak) id <UINavigationControllerDelegate, ZYQAssetPickerControllerDelegate> delegate;
@property (nonatomic, strong) ALAssetsFilter *assetsFilter;
@property (nonatomic, copy, readonly) NSArray *indexPathsForSelectedItems;
@property (nonatomic, assign) NSInteger maximumNumberOfSelection;
@property (nonatomic, assign) NSInteger minimumNumberOfSelection;
@property (nonatomic, strong) NSPredicate *selectionFilter;
@property (nonatomic, assign) BOOL showCancelButton;
@property (nonatomic, assign) BOOL showEmptyGroups;
@property (nonatomic, assign) BOOL isFinishDismissViewController;
@end
@protocol ZYQAssetPickerControllerDelegate <NSObject>
-(void)assetPickerController:(ZYQAssetPickerController *)picker didFinishPickingAssets:(NSArray *)assets;
@optional
-(void)assetPickerControllerDidCancel:(ZYQAssetPickerController *)picker;
-(void)assetPickerController:(ZYQAssetPickerController *)picker didSelectAsset:(ALAsset*)asset;
-(void)assetPickerController:(ZYQAssetPickerController *)picker didDeselectAsset:(ALAsset*)asset;
-(void)assetPickerControllerDidMaximum:(ZYQAssetPickerController *)picker;
-(void)assetPickerControllerDidMinimum:(ZYQAssetPickerController *)picker;
@end
#pragma mark - ZYQAssetViewController
@interface ZYQAssetViewController : UITableViewController
@property (nonatomic, strong) ALAssetsGroup *assetsGroup;
@property (nonatomic, strong) NSMutableArray *indexPathsForSelectedItems;
@end
#pragma mark - ZYQVideoTitleView
@interface ZYQVideoTitleView : UILabel
@end
#pragma mark - ZYQTapAssetView
@protocol ZYQTapAssetViewDelegate <NSObject>
-(void)touchSelect:(BOOL)select;
-(BOOL)shouldTap;
@end
@interface ZYQTapAssetView : UIView
@property (nonatomic, assign) BOOL selected;
@property (nonatomic, assign) BOOL disabled;
@property (nonatomic, weak) id<ZYQTapAssetViewDelegate> delegate;
@end
#pragma mark - ZYQAssetView
@protocol ZYQAssetViewDelegate <NSObject>
-(BOOL)shouldSelectAsset:(ALAsset*)asset;
-(void)tapSelectHandle:(BOOL)select asset:(ALAsset*)asset;
@end
@interface ZYQAssetView : UIView
- (void)bind:(ALAsset *)asset selectionFilter:(NSPredicate*)selectionFilter isSeleced:(BOOL)isSeleced;
@end
#pragma mark - ZYQAssetViewCell
@protocol ZYQAssetViewCellDelegate;
@interface ZYQAssetViewCell : UITableViewCell
@property(nonatomic,weak)id<ZYQAssetViewCellDelegate> delegate;
- (void)bind:(NSArray *)assets selectionFilter:(NSPredicate*)selectionFilter minimumInteritemSpacing:(float)minimumInteritemSpacing minimumLineSpacing:(float)minimumLineSpacing columns:(int)columns assetViewX:(float)assetViewX;
@end
@protocol ZYQAssetViewCellDelegate <NSObject>
- (BOOL)shouldSelectAsset:(ALAsset*)asset;
- (void)didSelectAsset:(ALAsset*)asset;
- (void)didDeselectAsset:(ALAsset*)asset;
@end
#pragma mark - ZYQAssetGroupViewCell
@interface ZYQAssetGroupViewCell : UITableViewCell
- (void)bind:(ALAssetsGroup *)assetsGroup;
@end
#pragma mark - ZYQAssetGroupViewController
@interface ZYQAssetGroupViewController : UITableViewController
@end
//
// FeedBackViewController.h
// XFFruit
// 行情反馈需要的行情单列表
// Created by freecui on 15/8/20.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
@interface SurveyFeedbackListViewController : ICRBaseViewController
@end
This diff is collapsed.
//
// WriteFeedbackViewController.h
// XFFruit
// 填写行情反馈
// Created by freecui on 15/8/20.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
@class Survey;
@interface WriteFeedbackViewController : ICRBaseViewController
@property (nonatomic,strong)Survey *survey;
@property (nonatomic,strong)NSString *surveyUuid;
@property (nonatomic, strong) NSArray *imgsFile;
- (instancetype)initWithImgName:(NSString *)imgName;
@end
This diff is collapsed.
//
// XFDB.h
// XFFruit
//
// Created by freecui on 15/8/24.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <Foundation/Foundation.h>
@class XFPhoto;
@interface XFDB : NSObject
+ (instancetype)sharedInstance;
- (BOOL)savePhoto: (XFPhoto *)aphoto ;
- (BOOL)deletePhoto: (NSData *)photoData;
- (NSMutableArray *)fetchAllPhotosFromLocal;
- (NSMutableArray *)fetchAllPhotosDataFromLocal;
@end
//
// XFDB.m
// XFFruit
//
// Created by freecui on 15/8/24.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "XFDB.h"
#import "XFPhoto.h"
//FMDB
#define DATABASE_PATH [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0]stringByAppendingString:@"/.db"]
@implementation XFDB
+ (instancetype)sharedInstance {
static XFDB *_sharedinstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedinstance = [[self alloc]init];
});
return _sharedinstance;
}
+ (BOOL)checkTableCreatedInDb: (FMDatabase *)db {
NSString *createStr = @"CREATE TABLE IF NOT EXISTS 'xfphoto'(ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, photoData VARCHAR)";//,position INTEGER
BOOL worked = [db executeUpdate:createStr];
return worked;
}
- (BOOL)savePhoto: (XFPhoto *)aphoto {
FMDatabase *db = [FMDatabase databaseWithPath:DATABASE_PATH];
if (![db open]) {
NSLog(@"数据库打开失败");
return NO;
}
[XFDB checkTableCreatedInDb:db];
NSString *insterStr = @"INSERT INTO 'xfphoto'('photoData') VALUES(?)";
BOOL worked = [db executeUpdate:insterStr,aphoto.photoData];//[NSString stringWithFormat:@"%@",aphoto.photoData]
[db close];
return worked;
}
- (BOOL)deletePhoto: (NSData *)photoData {
FMDatabase *db = [FMDatabase databaseWithPath:DATABASE_PATH];
if (![db open]) {
NSLog(@"数据库打开失败");
return NO;
}
[XFDB checkTableCreatedInDb:db];
NSString *delStr =[NSString stringWithFormat: @"DELETE FROM xfphoto where photoData = %@",photoData];
BOOL worked = [db executeUpdate:delStr];
[db close];
return worked;
}
- (NSMutableArray *)fetchAllPhotosFromLocal {
NSMutableArray *resultArr = [NSMutableArray array];
FMDatabase *db = [FMDatabase databaseWithPath:DATABASE_PATH];
if (![db open]) {
NSLog(@"数据库打开失败");
return resultArr;
}
[XFDB checkTableCreatedInDb:db];
FMResultSet *rs = [db executeQuery:@"select * from xfphoto"];
while ([rs next]) {
XFPhoto *xfPhoto = [[XFPhoto alloc]init];
xfPhoto.photoData = [rs dataForColumn:@"photoData"];
// xfPhoto.position = [rs intForColumn:@"position"];
[resultArr addObject:xfPhoto];
}
[rs close];
[db close];
return resultArr;
}
- (NSMutableArray *)fetchAllPhotosDataFromLocal {
NSMutableArray *resultArr = [NSMutableArray array];
FMDatabase *db = [FMDatabase databaseWithPath:DATABASE_PATH];
if (![db open]) {
NSLog(@"数据库打开失败");
return resultArr;
}
[XFDB checkTableCreatedInDb:db];
FMResultSet *rs = [db executeQuery:@"select * from xfphoto"];
while ([rs next]) {
NSData *photoData = [rs dataForColumn:@"photoData"];
[resultArr addObject:photoData];
}
[rs close];
[db close];
return resultArr;
}
@end
//
// XFPhotos.h
// XFFruit
//
// Created by freecui on 15/8/24.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTModel.h"
@interface XFPhoto : IBTModel
@property (assign, nonatomic) NSInteger ID;
@property (strong, nonatomic) NSData *photoData;
//@property (assign, nonatomic) NSInteger *position;
- (instancetype)initWithPhotoData: (NSData *)photoData;
@end
//
// XFPhotos.m
// XFFruit
//
// Created by freecui on 15/8/24.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "XFPhoto.h"
@implementation XFPhoto
- (instancetype)initWithPhotoData:(NSData *)photoData {
self = [super init];
if (self) {
self.photoData = photoData;
}
return self;
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment