diff --git a/XFFruit.xcodeproj/project.pbxproj b/XFFruit.xcodeproj/project.pbxproj index 5dfcc607429223450461e5da8ac5d27c0d4e2282..fd07f25d950ac251fe98ad126d80784a152029f8 100644 --- a/XFFruit.xcodeproj/project.pbxproj +++ b/XFFruit.xcodeproj/project.pbxproj @@ -347,6 +347,9 @@ FE2FCC881B7492C500BBC6FB /* ResultDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2FCC871B7492C500BBC6FB /* ResultDetailViewController.m */; }; FE2FCC8B1B74A9EE00BBC6FB /* SurveyResultCell.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2FCC8A1B74A9EE00BBC6FB /* SurveyResultCell.m */; }; FE4F17251B72FAAB00924DED /* ChosePersonViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4F17241B72FAAB00924DED /* ChosePersonViewController.m */; }; + FEAE16E91B79C9F9009D9E01 /* ResultView.m in Sources */ = {isa = PBXBuildFile; fileRef = FEAE16E81B79C9F9009D9E01 /* ResultView.m */; }; + FEAE16EC1B79CAA0009D9E01 /* TPCustomImageVIew.m in Sources */ = {isa = PBXBuildFile; fileRef = FEAE16EB1B79CAA0009D9E01 /* TPCustomImageVIew.m */; }; + FEAE16EF1B79CAE3009D9E01 /* SingleScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = FEAE16EE1B79CAE3009D9E01 /* SingleScrollView.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -734,6 +737,12 @@ FE2FCC8A1B74A9EE00BBC6FB /* SurveyResultCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SurveyResultCell.m; sourceTree = "<group>"; }; FE4F17231B72FAAB00924DED /* ChosePersonViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChosePersonViewController.h; sourceTree = "<group>"; }; FE4F17241B72FAAB00924DED /* ChosePersonViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChosePersonViewController.m; sourceTree = "<group>"; }; + FEAE16E71B79C9F9009D9E01 /* ResultView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResultView.h; sourceTree = "<group>"; }; + FEAE16E81B79C9F9009D9E01 /* ResultView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ResultView.m; sourceTree = "<group>"; }; + FEAE16EA1B79CAA0009D9E01 /* TPCustomImageVIew.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPCustomImageVIew.h; sourceTree = "<group>"; }; + FEAE16EB1B79CAA0009D9E01 /* TPCustomImageVIew.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TPCustomImageVIew.m; sourceTree = "<group>"; }; + FEAE16ED1B79CAE3009D9E01 /* SingleScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SingleScrollView.h; sourceTree = "<group>"; }; + FEAE16EE1B79CAE3009D9E01 /* SingleScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SingleScrollView.m; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -838,6 +847,8 @@ 7217E9E31B72364300FE5C1D /* SurveyListCell.m */, FE2FCC891B74A9EE00BBC6FB /* SurveyResultCell.h */, FE2FCC8A1B74A9EE00BBC6FB /* SurveyResultCell.m */, + FEAE16E71B79C9F9009D9E01 /* ResultView.h */, + FEAE16E81B79C9F9009D9E01 /* ResultView.m */, ); path = Views; sourceTree = "<group>"; @@ -845,6 +856,10 @@ 7217E9D21B72364300FE5C1D /* GrowingTextView */ = { isa = PBXGroup; children = ( + FEAE16ED1B79CAE3009D9E01 /* SingleScrollView.h */, + FEAE16EE1B79CAE3009D9E01 /* SingleScrollView.m */, + FEAE16EA1B79CAA0009D9E01 /* TPCustomImageVIew.h */, + FEAE16EB1B79CAA0009D9E01 /* TPCustomImageVIew.m */, 7217E9D31B72364300FE5C1D /* HPGrowingTextView.h */, 7217E9D41B72364300FE5C1D /* HPGrowingTextView.m */, 7217E9D51B72364300FE5C1D /* HPTextViewInternal.h */, @@ -1969,11 +1984,13 @@ C123A8FD1B2561E1003C0C36 /* JTPopupView.m in Sources */, 300DD94E1B184EA70080EE12 /* ICRQuestion.m in Sources */, 7217E9E81B72364300FE5C1D /* Survey.m in Sources */, + FEAE16EC1B79CAA0009D9E01 /* TPCustomImageVIew.m in Sources */, C1FE50561AE3587F00C18080 /* ICRAttachmentUnit.m in Sources */, 30D7494C1ACE340D00C63BA1 /* ICRModifyPwdViewController.m in Sources */, C10214CD1AD8FE200024637E /* ICRStoreDetailViewController.m in Sources */, C142D2B81AC3A155000109A7 /* UIResponder+FirstResponder.m in Sources */, 30D3C1251ADF6451004AC54E /* ICRAnnouncementDetailContentView.m in Sources */, + FEAE16E91B79C9F9009D9E01 /* ResultView.m in Sources */, C142D2C01AC3A155000109A7 /* UIView+ViewFrameGeometry.m in Sources */, C1FE50451AE0249A00C18080 /* IBTImagePicker.m in Sources */, C1E108611ADA8D3800620375 /* ICRAttachment.m in Sources */, @@ -1993,6 +2010,7 @@ 7217E9F41B72364300FE5C1D /* SurveyListCell.m in Sources */, C10214D21AD904F30024637E /* ICRPatrolPlanViewController.m in Sources */, C1E108591ADA53C700620375 /* ICRTaskResultViewController.m in Sources */, + FEAE16EF1B79CAE3009D9E01 /* SingleScrollView.m in Sources */, C10C909D1AE56E8700B911CD /* JTOptionsViewController.m in Sources */, C1C5644F1AD6719B006A1050 /* ICRTaskDetailViewController.m in Sources */, C1E1085D1ADA577500620375 /* ICRTaskDetailContentView.m in Sources */, @@ -2229,7 +2247,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 7.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; - PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4"; + PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; @@ -2267,7 +2285,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 7.0; MTL_ENABLE_DEBUG_INFO = NO; - PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4"; + PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; @@ -2291,7 +2309,7 @@ "$(PROJECT_DIR)", ); PRODUCT_NAME = XFFruit; - PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4"; + PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; }; name = Debug; @@ -2312,7 +2330,7 @@ "$(PROJECT_DIR)", ); PRODUCT_NAME = XFFruit; - PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4"; + PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; }; name = Release; @@ -2335,7 +2353,7 @@ INFOPLIST_FILE = XFFruitTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = XFFruitTests; - PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4"; + PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XFFruit.app/XFFruit"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; }; @@ -2355,7 +2373,7 @@ INFOPLIST_FILE = XFFruitTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = XFFruitTests; - PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4"; + PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XFFruit.app/XFFruit"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; }; diff --git a/XFFruit/Utilities/IBTUIKit/IBTConstants.h b/XFFruit/Utilities/IBTUIKit/IBTConstants.h index 9abeb55c53eb40fc2381c776f647bc0eb1bb8efa..0f85c9165ccc54304896c79ed481c3efde461568 100644 --- a/XFFruit/Utilities/IBTUIKit/IBTConstants.h +++ b/XFFruit/Utilities/IBTUIKit/IBTConstants.h @@ -91,6 +91,7 @@ #define ScreenSize ([[UIScreen mainScreen] bounds].size) #define IOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) #define FontSize(num) [UIFont systemFontOfSize:num] +#define AppWindow [[UIApplication sharedApplication].delegate window] diff --git a/XFFruit/ViewControllers/Survey/Views/GrowingTextView/SingleScrollView.h b/XFFruit/ViewControllers/Survey/Views/GrowingTextView/SingleScrollView.h new file mode 100755 index 0000000000000000000000000000000000000000..60820f29e3804fe88844b76935fa388a87fc1736 --- /dev/null +++ b/XFFruit/ViewControllers/Survey/Views/GrowingTextView/SingleScrollView.h @@ -0,0 +1,16 @@ +// +// SingleScrollView.h +// PhotoWallDemo +// +// Created by LZXuan on 14-8-18. +// Copyright (c) 2014å¹´ LZXuan. All rights reserved. +// + +#import <UIKit/UIKit.h> + +@interface SingleScrollView : UIScrollView +// +- (SingleScrollView *)initWithFrame:(CGRect)frame image:(NSString *)image; +//ç»™è‡ªå®šä¹‰æ»šåŠ¨æ—¶å€™å¢žåŠ åŒå‡»å’Œå•击事件 +- (void)addSingleClickTarget:(id)target action:(SEL)action; +@end diff --git a/XFFruit/ViewControllers/Survey/Views/GrowingTextView/SingleScrollView.m b/XFFruit/ViewControllers/Survey/Views/GrowingTextView/SingleScrollView.m new file mode 100755 index 0000000000000000000000000000000000000000..88221c8db55c1cbdccd4013c370c623b98b069c4 --- /dev/null +++ b/XFFruit/ViewControllers/Survey/Views/GrowingTextView/SingleScrollView.m @@ -0,0 +1,84 @@ +// +// SingleScrollView.m +// PhotoWallDemo +// +// Created by LZXuan on 14-8-18. +// Copyright (c) 2014å¹´ LZXuan. All rights reserved. +// + +#import "SingleScrollView.h" +#import "UIImageView+WebCache.h" +#define SW 1 + +@interface SingleScrollView() +@property (nonatomic,assign) id target; +@property (nonatomic,assign) SEL action; + +@property (nonatomic,assign) id targetD; +@property (nonatomic,assign) SEL actionD; +@end +@implementation SingleScrollView +{ + UIImageView *_imageView; +} + +- (id)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + // Initialization code + + + } + return self; +} +- (SingleScrollView *)initWithFrame:(CGRect)frame image:(NSString *)image{ + if (self = [super initWithFrame:frame]) { + self.showsHorizontalScrollIndicator = NO; + self.showsVerticalScrollIndicator = NO; + //è®¾ç½®æœ€å¤§æ”¾å¤§å€æ•° + self.minimumZoomScale = 1.0; + self.maximumZoomScale = 2.0; + //ç²˜è´´ä¸€å¼ å›¾ç‰‡ + _imageView = [[UIImageView alloc] init]; + + + _imageView.frame = CGRectMake(0, 0, self.frame.size.width - 10*2, self.frame.size.height); + _imageView.center = CGPointMake(self.frame.size.width/2, self.frame.size.height/2); + if ([image hasPrefix:@"http://"]) { + NSURL *url = [NSURL URLWithString:image]; + [_imageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"leftDetailBg.png"]]; + }else{ + _imageView.image=[UIImage imageNamed:image]; + } + _imageView.contentMode = UIViewContentModeScaleAspectFit; + [self addSubview:_imageView]; + } + return self; +} +- (void)addSingleClickTarget:(id)target action:(SEL)action{ + self.target = target; + self.action = action; + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)]; + + tap.numberOfTapsRequired = 1; + [self addGestureRecognizer:tap]; +// UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] +// initWithTarget:self action:@selector(pinch:)]; +// [self addGestureRecognizer:pinch]; + + +} +- (void)tap:(UITapGestureRecognizer *)tap{ + if ([self.target respondsToSelector:self.action]) { + [self.target performSelector:self.action withObject:self]; + } +} + +//- (void)pinch:(UIPinchGestureRecognizer *)pinch{ +// //通过触摸当å‰çš„图片视图 è®©ç›®æ ‡å¯¹è±¡æŒ‡å‘ç›®æ ‡å¯¹è±¡çš„è¡Œä¸º +// if ([self.target respondsToSelector:self.action]) { +// [self.target performSelector:self.action withObject:pinch withObject:self]; +// } +//} +@end diff --git a/XFFruit/ViewControllers/Survey/Views/GrowingTextView/TPCustomImageVIew.h b/XFFruit/ViewControllers/Survey/Views/GrowingTextView/TPCustomImageVIew.h new file mode 100644 index 0000000000000000000000000000000000000000..c048e423956575c37e2f389d12ea08108a7c89e6 --- /dev/null +++ b/XFFruit/ViewControllers/Survey/Views/GrowingTextView/TPCustomImageVIew.h @@ -0,0 +1,13 @@ +// +// TPCustomImageVIew.h +// CNTaipingAgent +// +// Created by 陈俊俊 on 15/1/28. +// Copyright (c) 2015å¹´ Taiping. All rights reserved. +// + +#import <UIKit/UIKit.h> + +@interface TPCustomImageVIew : UIImageView +- (id)initwithTarget:(id)target action:(SEL)action; +@end diff --git a/XFFruit/ViewControllers/Survey/Views/GrowingTextView/TPCustomImageVIew.m b/XFFruit/ViewControllers/Survey/Views/GrowingTextView/TPCustomImageVIew.m new file mode 100644 index 0000000000000000000000000000000000000000..99fd44e21a92fa134e2023e09111d4c8c144a26d --- /dev/null +++ b/XFFruit/ViewControllers/Survey/Views/GrowingTextView/TPCustomImageVIew.m @@ -0,0 +1,41 @@ +// +// TPCustomImageVIew.m +// CNTaipingAgent +// +// Created by 陈俊俊 on 15/1/28. +// Copyright (c) 2015å¹´ Taiping. All rights reserved. +// + +#import "TPCustomImageVIew.h" + +@interface TPCustomImageVIew() +@property (nonatomic,assign) id target; +@property (nonatomic,assign) SEL action; +@end + +@implementation TPCustomImageVIew + +- (id)initwithTarget:(id)target action:(SEL)action +{ + if (self == [super init]) { + + self.userInteractionEnabled = YES; + UITapGestureRecognizer *tapRecongnizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tap)]; + tapRecongnizer.numberOfTapsRequired = 1; + [self addGestureRecognizer:tapRecongnizer]; + + self.target =target; + self.action = action; + + } + return self; +} + +- (void)tap{ + //通过触摸当å‰çš„图片视图 è®©ç›®æ ‡å¯¹è±¡æŒ‡å‘ç›®æ ‡å¯¹è±¡çš„è¡Œä¸º + if ([self.target respondsToSelector:self.action]) { + [self.target performSelector:self.action withObject:self]; + } +} + +@end diff --git a/XFFruit/ViewControllers/Survey/Views/ResultView.h b/XFFruit/ViewControllers/Survey/Views/ResultView.h new file mode 100644 index 0000000000000000000000000000000000000000..3f910e88d9b3c7be0f3cf96bca0aeb47d1ab26e6 --- /dev/null +++ b/XFFruit/ViewControllers/Survey/Views/ResultView.h @@ -0,0 +1,24 @@ +// +// ResultView.h +// XFFruit +// +// Created by 陈俊俊 on 15/8/11. +// Copyright (c) 2015å¹´ Xummer. All rights reserved. +// + +#import <UIKit/UIKit.h> + +@protocol ResultViewDelegate <NSObject> +//scrollView点击事件 +- (void)clickBackButton; + + +@end +@interface ResultView : UIView +@property (nonatomic,strong)NSArray *images;//å¤–éƒ¨ä¼ æ¥çš„æ•°ç»„ +@property (nonatomic,assign)NSInteger index;//记录是哪个图片 + +@property (nonatomic,weak)id<ResultViewDelegate>delegate; +- (void)setScrollView;//设置ScrollView + +@end diff --git a/XFFruit/ViewControllers/Survey/Views/ResultView.m b/XFFruit/ViewControllers/Survey/Views/ResultView.m new file mode 100644 index 0000000000000000000000000000000000000000..3b44f35eaa034c294b716d408d6be0471907c7cf --- /dev/null +++ b/XFFruit/ViewControllers/Survey/Views/ResultView.m @@ -0,0 +1,113 @@ +// +// ResultView.m +// XFFruit +// +// Created by 陈俊俊 on 15/8/11. +// Copyright (c) 2015å¹´ Xummer. All rights reserved. +// + +#import "ResultView.h" +#import "TPCustomImageVIew.h" +#import "UIImageView+WebCache.h" +#import "SingleScrollView.h" +#import "Attachment.h" +#define TPSamleVT_Top_Height 10 +#define Back_Btn_Width 37 +#define Back_Btn_Height 36 +@interface ResultView()<UIScrollViewDelegate,UIGestureRecognizerDelegate> +{ + NSMutableArray *_imagesArray; + UIScrollView *_scrollView; +} + +@end + +@implementation ResultView + +- (id)initWithFrame:(CGRect)frame{ + if (self = [super initWithFrame:frame]) { + _imagesArray = [NSMutableArray new]; + + _scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, TPSamleVT_Top_Height, self.frame.size.width, self.frame.size.height-TPSamleVT_Top_Height*2)]; + _scrollView.delegate = self; + _scrollView.showsHorizontalScrollIndicator = NO; + _scrollView.showsVerticalScrollIndicator = NO; + _scrollView.pagingEnabled = YES; + [self addSubview:_scrollView]; + } + return self; +} + +- (void)setScrollView{ + [self setImagesArray]; + _scrollView.contentSize = CGSizeMake(_scrollView.frame.size.width * _imagesArray.count ,_scrollView.frame.size.height); + _scrollView.contentOffset = CGPointMake(_scrollView.frame.size.width*(self.index+1), 0); + _scrollView.alpha = 0; + [UIView animateWithDuration:1 animations:^{ + _scrollView.alpha = 1; + }]; + [self createImageButton]; + +} + + +//创建滚动视图上的图片按钮 +- (void)createImageButton{ + for (NSInteger i = 0; i < _imagesArray.count; i++) { + SingleScrollView *customView = [[SingleScrollView alloc] initWithFrame: CGRectMake(_scrollView.frame.size.width*(i),0 , self.frame.size.width, _scrollView.frame.size.height) image:_imagesArray[i]]; + [customView addSingleClickTarget:self action:@selector(imageViewHide)]; + customView.delegate = self; + [_scrollView addSubview:customView]; + } +} + +//为图片数组赋值 +- (void)setImagesArray{ + [_imagesArray removeAllObjects]; + if (self.images.count >0) { + Attachment *att =[self.images lastObject]; + [_imagesArray addObject:att.content]; + for (Attachment *typeBo in self.images) { + [_imagesArray addObject:typeBo.content]; + } + Attachment *endTypeBo = self.images[0]; + [_imagesArray addObject:endTypeBo.content]; + }else{ + [_imagesArray addObject:@"HomeDisplayImage"]; + [_imagesArray addObject:@"HomeDisplayImage"]; + [_imagesArray addObject:@"HomeDisplayImage"]; + } + +} +#pragma mark - scrollViewå议的方法 +- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView +{ + float offsetX=_scrollView.contentOffset.x; + if (offsetX/_scrollView.frame.size.width==0) { + _scrollView.contentOffset=CGPointMake(scrollView.frame.size.width*(_imagesArray.count-2), 0); + + }else if (offsetX/scrollView.frame.size.width==_imagesArray.count-1) { + _scrollView.contentOffset=CGPointMake(scrollView.frame.size.width*1, 0); + + } + if (![scrollView isKindOfClass:[SingleScrollView class]]) { + for (SingleScrollView *sv in scrollView.subviews) { + //如果 自定义的滚动视图 有放大 那么在滚动下方的滚动视图å‡é€Ÿåœæ¢çš„æ—¶å€™ è¿˜åŽŸè‡ªå®šä¹‰æ»šåŠ¨è§†å›¾çš„å¤§å° + sv.zoomScale = 1; + } + } + +} +#pragma mark - æ‰‹åŠ¿è§¦å‘ +- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{ + if ([scrollView isKindOfClass:[SingleScrollView class]]) { + return scrollView.subviews[0]; + } + return nil; +} +#pragma mark - 按钮触å‘事件 +- (void)imageViewHide +{ + [self.delegate clickBackButton]; +} +@end diff --git a/XFFruit/ViewControllers/Survey/controllers/ResultDetailViewController.m b/XFFruit/ViewControllers/Survey/controllers/ResultDetailViewController.m index 8eb577cc310780fe36b57b149ea0bdbeaa4e2a2d..a7f5e7bbe5b1cfa83216901068f6bb7954ad5e43 100644 --- a/XFFruit/ViewControllers/Survey/controllers/ResultDetailViewController.m +++ b/XFFruit/ViewControllers/Survey/controllers/ResultDetailViewController.m @@ -9,11 +9,14 @@ #import "ResultDetailViewController.h" #import "SurveyResult.h" #import "SurveyResultCell.h" +#import "ResultView.h" #define TableHeight 150 -@interface ResultDetailViewController ()<UITableViewDataSource,UITableViewDelegate> +#define BeginTag 6000 +@interface ResultDetailViewController ()<UITableViewDataSource,UITableViewDelegate,ResultViewDelegate> { UITableView *_tableView; NSMutableArray *_dataArr; + ResultView *_resultView; } @end @@ -65,7 +68,8 @@ if (_dataArr.count > 0) { SurveyResult *survey = _dataArr[indexPath.row]; cell.surveyResult = survey; - + cell.tag = indexPath.row + BeginTag; + [cell.imageBtn addTarget:self action:@selector(imageClick:) forControlEvents:UIControlEventTouchUpInside]; } return cell; } @@ -73,6 +77,27 @@ return TableHeight; } +- (void)imageClick:(UIButton *)btn { +// SurveyResult *result = _dataArr[btn.tag - BeginTag]; + //创建详情view + if (_resultView == nil) { + _resultView = [[ResultView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, ScreenSize.height)]; + _resultView.delegate = self; + _resultView.backgroundColor = RGBA(0, 0, 0, 0.5); + [_resultView setScrollView]; + [AppWindow addSubview:_resultView]; + } + +} + +#pragma mark - resultViewå议方法 +- (void)clickBackButton{ + if (_resultView) { + [_resultView removeFromSuperview]; + _resultView = nil; + } +} + - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; diff --git a/XFFruit/ViewControllers/Survey/controllers/SurveyViewController.m b/XFFruit/ViewControllers/Survey/controllers/SurveyViewController.m index 94bac03b22e828eb241ae1ecd00860fced72e923..971587d0d5faf17c6d9a13f078d77e1b236f7178 100644 --- a/XFFruit/ViewControllers/Survey/controllers/SurveyViewController.m +++ b/XFFruit/ViewControllers/Survey/controllers/SurveyViewController.m @@ -52,39 +52,39 @@ typedef enum : NSUInteger { - (void)initData{ _dataArr = [NSMutableArray array]; - //ä¿å˜ - void(^succ)(id) = ^(id data) { - [IBTLoadingView hideHUDWithText:nil]; - NSLog(@"%@",data); - }; - void(^fail)(id) = ^(id data) { - [IBTLoadingView hideHUDWithText:nil]; - [IBTLoadingView showTips:data]; - }; - [IBTLoadingView showProgressLabel:@"æ£åœ¨ä¿å˜..."]; - [[ICRHTTPController sharedController] querySurveyWithBillNUmberLinke:@"fdsfds" state:@"initial" titleLike:@"fds" orderFiled:@"fdsafds" orderDirection:@"asc" page_number:1 page_size:10 success:succ failure:fail]; +// //ä¿å˜ +// void(^succ)(id) = ^(id data) { +// [IBTLoadingView hideHUDWithText:nil]; +// NSLog(@"%@",data); +// }; +// void(^fail)(id) = ^(id data) { +// [IBTLoadingView hideHUDWithText:nil]; +// [IBTLoadingView showTips:data]; +// }; +// [IBTLoadingView showProgressLabel:@"æ£åœ¨ä¿å˜..."]; +// [[ICRHTTPController sharedController] querySurveyWithBillNUmberLinke:@"fdsfds" state:@"initial" titleLike:@"fds" orderFiled:@"fdsafds" orderDirection:@"asc" page_number:1 page_size:10 success:succ failure:fail]; // [[ICRHTTPController sharedController] getResultsWithSurveyUuid:@"111" success:succ failure:fail]; -// for (NSInteger i = 0; i < 4; i++) { -// Survey *survey = [[Survey alloc]init]; -// survey.title = @"å—æ±‡8424è¥¿ç“œè°ƒç ”æƒ…å†µ"; -// survey.billnumber = @"150605000001"; -// survey.productname = @"å—æ±‡842[100213]"; -// survey.productcode = @"22222222222"; -// survey.remark = @"è´¹å¡æŽ¥å£æµªæ ¼å¯æ”¾å¤§æ–‡åŒ–大fdsafç¼´è´¹å¡æŽ¥å£æµªè´¹ç¼´è´¹å¡ä¸Šå°±ä»˜æ¬¾æ”¾å‡å¿«ä¹æ’’å³å¯ä¹¦æ³•å®¶å¼€å‘商"; -// survey.begindate = [IBTCommon convertToDateFrom:@"2015.05.25"]; -// survey.enddate = [IBTCommon convertToDateFrom:@"2015.08.06"]; -// [_dataArr addObject:survey]; -// if (i == 0) { -// survey.state = @"saved"; -// }else if (i == 1) { -// survey.state = @"submitted"; -// }else if (i == 2) { -// survey.state = @"insurvey"; -// }else if (i == 3) { -// survey.state = @"finished"; -// } -// } + for (NSInteger i = 0; i < 4; i++) { + Survey *survey = [[Survey alloc]init]; + survey.title = @"å—æ±‡8424è¥¿ç“œè°ƒç ”æƒ…å†µ"; + survey.billnumber = @"150605000001"; + survey.productname = @"å—æ±‡842[100213]"; + survey.productcode = @"22222222222"; + survey.remark = @"è´¹å¡æŽ¥å£æµªæ ¼å¯æ”¾å¤§æ–‡åŒ–大fdsafç¼´è´¹å¡æŽ¥å£æµªè´¹ç¼´è´¹å¡ä¸Šå°±ä»˜æ¬¾æ”¾å‡å¿«ä¹æ’’å³å¯ä¹¦æ³•å®¶å¼€å‘商"; + survey.begindate = [IBTCommon convertToDateFrom:@"2015.05.25"]; + survey.enddate = [IBTCommon convertToDateFrom:@"2015.08.06"]; + [_dataArr addObject:survey]; + if (i == 0) { + survey.state = @"saved"; + }else if (i == 1) { + survey.state = @"submitted"; + }else if (i == 2) { + survey.state = @"insurvey"; + }else if (i == 3) { + survey.state = @"finished"; + } + } } - (void)createTableView {