diff --git a/ManagerDemo.xcodeproj/project.pbxproj b/ManagerDemo.xcodeproj/project.pbxproj index 7c3331a..5379191 100644 --- a/ManagerDemo.xcodeproj/project.pbxproj +++ b/ManagerDemo.xcodeproj/project.pbxproj @@ -29,8 +29,6 @@ A94FE520199C9C6800626DE5 /* MoveSocialCellView.xib in Resources */ = {isa = PBXBuildFile; fileRef = A94FE51F199C9C6800626DE5 /* MoveSocialCellView.xib */; }; A96F2A7C199D008200608237 /* UIButton+Bootstrap.m in Sources */ = {isa = PBXBuildFile; fileRef = A96F2A7B199D008200608237 /* UIButton+Bootstrap.m */; }; A96F2A7F199D01C000608237 /* NSString+FontAwesome.m in Sources */ = {isa = PBXBuildFile; fileRef = A96F2A7E199D01C000608237 /* NSString+FontAwesome.m */; }; - A96F2A85199D1D6800608237 /* HdPageControl.m in Sources */ = {isa = PBXBuildFile; fileRef = A96F2A82199D1D6800608237 /* HdPageControl.m */; }; - A96F2A86199D1D6800608237 /* HDScrollview.m in Sources */ = {isa = PBXBuildFile; fileRef = A96F2A84199D1D6800608237 /* HDScrollview.m */; }; A988A8FC199A50D900EB10AA /* TriangleView.m in Sources */ = {isa = PBXBuildFile; fileRef = A988A8FB199A50D900EB10AA /* TriangleView.m */; }; A988A900199A751500EB10AA /* FundListCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A988A8FF199A751500EB10AA /* FundListCell.m */; }; A988A902199A755300EB10AA /* FundListCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = A988A901199A755300EB10AA /* FundListCell.xib */; }; @@ -168,10 +166,6 @@ A96F2A7B199D008200608237 /* UIButton+Bootstrap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIButton+Bootstrap.m"; sourceTree = ""; }; A96F2A7D199D01C000608237 /* NSString+FontAwesome.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+FontAwesome.h"; sourceTree = ""; }; A96F2A7E199D01C000608237 /* NSString+FontAwesome.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+FontAwesome.m"; sourceTree = ""; }; - A96F2A81199D1D6800608237 /* HdPageControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HdPageControl.h; sourceTree = ""; }; - A96F2A82199D1D6800608237 /* HdPageControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HdPageControl.m; sourceTree = ""; }; - A96F2A83199D1D6800608237 /* HDScrollview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDScrollview.h; sourceTree = ""; }; - A96F2A84199D1D6800608237 /* HDScrollview.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDScrollview.m; sourceTree = ""; }; A988A8FA199A50D900EB10AA /* TriangleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TriangleView.h; sourceTree = ""; }; A988A8FB199A50D900EB10AA /* TriangleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TriangleView.m; sourceTree = ""; }; A988A8FE199A751500EB10AA /* FundListCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FundListCell.h; sourceTree = ""; }; @@ -375,17 +369,6 @@ path = UIButtonUtil; sourceTree = ""; }; - A96F2A80199D1D6800608237 /* HDScrollView */ = { - isa = PBXGroup; - children = ( - A96F2A81199D1D6800608237 /* HdPageControl.h */, - A96F2A82199D1D6800608237 /* HdPageControl.m */, - A96F2A83199D1D6800608237 /* HDScrollview.h */, - A96F2A84199D1D6800608237 /* HDScrollview.m */, - ); - path = HDScrollView; - sourceTree = ""; - }; A988A8F9199A50B600EB10AA /* UIViewShape */ = { isa = PBXGroup; children = ( @@ -535,7 +518,6 @@ A9AF6C4A19949B510076C0EE /* Common */ = { isa = PBXGroup; children = ( - A96F2A80199D1D6800608237 /* HDScrollView */, A96F2A79199D007700608237 /* UIButtonUtil */, A988A8F9199A50B600EB10AA /* UIViewShape */, A93F87C71999E4DA00875287 /* AttributedString */, @@ -855,8 +837,6 @@ files = ( A93F8801199A077F00875287 /* ListViewController.m in Sources */, A988A8FC199A50D900EB10AA /* TriangleView.m in Sources */, - A96F2A85199D1D6800608237 /* HdPageControl.m in Sources */, - A96F2A86199D1D6800608237 /* HDScrollview.m in Sources */, A9EAA05619988C55001A872A /* MRCircularProgressView.m in Sources */, A9AF6C961994C5700076C0EE /* UIView+Extension.m in Sources */, A9AF6C921994C5700076C0EE /* MJRefreshFooterView.m in Sources */, diff --git a/ManagerDemo.xcworkspace/xcuserdata/xmfish.xcuserdatad/UserInterfaceState.xcuserstate b/ManagerDemo.xcworkspace/xcuserdata/xmfish.xcuserdatad/UserInterfaceState.xcuserstate index 4adfdea..a060c1c 100644 Binary files a/ManagerDemo.xcworkspace/xcuserdata/xmfish.xcuserdatad/UserInterfaceState.xcuserstate and b/ManagerDemo.xcworkspace/xcuserdata/xmfish.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/ManagerDemo/Common/HDScrollView/HDScrollview.h b/ManagerDemo/Common/HDScrollView/HDScrollview.h deleted file mode 100644 index 6baec95..0000000 --- a/ManagerDemo/Common/HDScrollView/HDScrollview.h +++ /dev/null @@ -1,39 +0,0 @@ -// -// HdScrollView.h -// ScrollView -// -// Created by Hu Di on 13-10-11. -// Copyright (c) 2013年 Sanji. All rights reserved. -// - -#import -#import "HdPageControl.h" -@protocol HDScrollviewDelegate --(void)TapView:(int)index; -@end - -@interface HDScrollview : UIScrollView - -@property (nonatomic, strong) NSTimer *autoScrollTimer; -@property (nonatomic,strong) HdPageControl *pagecontrol; -@property (nonatomic,assign) NSInteger currentPageIndex; -@property (assign,nonatomic) id HDdelegate; -@property (nonatomic, assign) BOOL autoScroll; // default is YES, set NO to turn off autoScroll -@property (nonatomic, assign) NSUInteger scrollInterval; -/** - * @brief 不循环 - */ --(id)initWithFrame:(CGRect)frame withImageView:(NSMutableArray *)imageview; - -/** - * @brief 循环滚动 - */ --(id)initLoopScrollWithFrame:(CGRect)frame withImageView:(NSMutableArray *)imageview; --(void)HDscrollViewDidScroll; --(void)HDscrollViewDidEndDecelerating; -@end - -@interface UIImageView (CopyImageview) -@end - - diff --git a/ManagerDemo/Common/HDScrollView/HDScrollview.m b/ManagerDemo/Common/HDScrollView/HDScrollview.m deleted file mode 100644 index 5ed5a4e..0000000 --- a/ManagerDemo/Common/HDScrollView/HDScrollview.m +++ /dev/null @@ -1,248 +0,0 @@ -// -// HdScrollView.m -// ScrollView -// -// Created by Hu Di on 13-10-11. -// Copyright (c) 2013年 Sanji. All rights reserved. -// - -#import "HDScrollview.h" -@interface HDScrollview() -{ - BOOL loop; - NSMutableArray *imageArray; -} -@end -@implementation HDScrollview - -- (id)initWithFrame:(CGRect)frame -{ - self = [super initWithFrame:frame]; - if (self) { - // Initialization code - self.showsHorizontalScrollIndicator = NO; - self.showsVerticalScrollIndicator = NO; - self.scrollsToTop = NO; - self.pagingEnabled=YES; - self.bounces=NO; - self.userInteractionEnabled=YES; - [self setContentOffset:CGPointMake(0, 0)]; - [self setContentOffset:CGPointMake(self.frame.size.width, 0)]; - UITapGestureRecognizer *Recognizer=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tap)]; - Recognizer.numberOfTapsRequired=1; - [self addGestureRecognizer:Recognizer]; - - if (!self.pagecontrol) { - self.pagecontrol=[[HdPageControl alloc]init]; - self.pagecontrol.currentPage=0;//当前页数 - self.pagecontrol.userInteractionEnabled = YES; - [self.pagecontrol addTarget:self action:@selector(pageTurn:) forControlEvents:UIControlEventTouchUpInside]; - } - } - return self; -} - --(id)initWithFrame:(CGRect)frame withImageView:(NSMutableArray *)imageviewarr -{ - self = [self initWithFrame:frame]; - if (self) - { - } - imageArray=[[NSMutableArray alloc] initWithArray:imageviewarr]; - loop=NO; - NSUInteger pageCount=[imageviewarr count]; - [self setContentSize:CGSizeMake(self.frame.size.width*pageCount, self.frame.size.height)]; - - CGRect bounds=self.frame; - for (int i=0; i 0) { - [self setContentOffset:CGPointMake(self.contentOffset.x, 0)]; - return; - } - if (loop) { - CGFloat pageWidth = self.frame.size.width; - int page = floor((self.contentOffset.x - pageWidth / 2) / pageWidth)+1; - self.currentPageIndex=page; - if (self.currentPageIndex == 5) { - page = 1; - } - self.pagecontrol.currentPage=(page-1); - } -} - --(void)HDscrollViewDidEndDecelerating -{ - if (self.autoScrollTimer && self.autoScrollTimer.isValid) { - [self.autoScrollTimer invalidate]; - } - self.autoScrollTimer = [NSTimer scheduledTimerWithTimeInterval:self.scrollInterval target:self selector:@selector(handleScrollTimer:) userInfo:nil repeats:YES]; - if (loop) { - if (0==self.currentPageIndex) { - [self setContentOffset:CGPointMake([imageArray count]*self.bounds.size.width, 0)]; - } - if (([imageArray count]+1)==self.currentPageIndex) { - [self setContentOffset:CGPointMake(self.bounds.size.width, 0)]; - [self HDscrollViewDidScroll]; - - } - } - else - { - //更新UIPageControl的当前页 - CGPoint offset = self.contentOffset; - CGRect bounds = self.frame; - [self.pagecontrol setCurrentPage:offset.x / bounds.size.width]; - } -} --(void)tap -{ - [self.HDdelegate TapView:self.pagecontrol.currentPage]; -} - --(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context -{ - if ([keyPath isEqualToString:@"currentPage"]) { - [self pageTurn:self.pagecontrol]; - [self.pagecontrol removeObserver:self forKeyPath:@"currentPage"]; - } -} -/* - // Only override drawRect: if you perform custom drawing. - // An empty implementation adversely affects performance during animation. - - (void)drawRect:(CGRect)rect - { - // Drawing code - } - */ - -@end - - -@implementation UIImageView (CopyImageview) --(void)encodeWithCoder:(NSCoder *)aCoder -{ - - [aCoder encodeObject:self.backgroundColor forKey:@"backgroundColor"]; - [aCoder encodeObject:self.image forKey:@"image"]; - [aCoder encodeInt:self.contentMode forKey:@"contentMode"]; - [aCoder encodeInt:self.subviews.count forKey:@"subviewscount"]; - for(int i=0;i - -@interface HdPageControl : UIPageControl -@property (strong,nonatomic)UIColor *currentcolor; -@property (strong,nonatomic)UIColor *othercolor; -@end diff --git a/ManagerDemo/Common/HDScrollView/HdPageControl.m b/ManagerDemo/Common/HDScrollView/HdPageControl.m deleted file mode 100644 index 2576740..0000000 --- a/ManagerDemo/Common/HDScrollView/HdPageControl.m +++ /dev/null @@ -1,80 +0,0 @@ -// -// HdPageControl.m -// ScrollView -// -// Created by Hu Di on 13-11-20. -// Copyright (c) 2013年 Sanji. All rights reserved. -// - -#import "HdPageControl.h" -#define IOS7 [[UIDevice currentDevice].systemVersion doubleValue]>=7.0 -@implementation HdPageControl - -- (id)initWithFrame:(CGRect)frame -{ - self = [super initWithFrame:frame]; - if (self) { - // Initialization code - } - return self; -} --(void) updateDots -{ - for (int i = 0; i < [self.subviews count]; i++) - { - UIView* pageIcon = [self.subviews objectAtIndex:i]; - pageIcon.layer.cornerRadius=3; - pageIcon.layer.masksToBounds=YES; - //NSLog(@"%@",NSStringFromClass([pageIcon class])); - if ([NSStringFromClass([pageIcon class]) isEqualToString:@"UIImageView"]) { - if (i == self.currentPage) - { - ((UIImageView*)pageIcon).image=[self createImageWithColor:self.currentcolor]; - } - else - { - ((UIImageView*)pageIcon).image=[self createImageWithColor:self.othercolor]; - } - } - else - { - if (i == self.currentPage) - { - pageIcon.backgroundColor=self.currentcolor; - } - else - { - pageIcon.backgroundColor=self.othercolor; - } - - } - - } - -} --(void) setCurrentPage:(NSInteger)page -{ - [super setCurrentPage:page]; - [self updateDots]; -} -- (UIImage *)createImageWithColor:(UIColor *)color -{ - CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); - UIGraphicsBeginImageContext(rect.size); - CGContextRef context = UIGraphicsGetCurrentContext(); - CGContextSetFillColorWithColor(context, [color CGColor]); - CGContextFillRect(context, rect); - UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - return theImage; -} -/* -// Only override drawRect: if you perform custom drawing. -// An empty implementation adversely affects performance during animation. -- (void)drawRect:(CGRect)rect -{ - // Drawing code -} -*/ - -@end diff --git a/ManagerDemo/MainView/HomeView/HomeAdView.h b/ManagerDemo/MainView/HomeView/HomeAdView.h index bce2ac9..914b9ed 100644 --- a/ManagerDemo/MainView/HomeView/HomeAdView.h +++ b/ManagerDemo/MainView/HomeView/HomeAdView.h @@ -7,11 +7,8 @@ // #import -#import "HDScrollview.h" #import "ImagePlayerView.h" -@interface HomeAdView : UIView +@interface HomeAdView : UIView { - HDScrollview* _scrollview; } -@property(strong, nonatomic)HDScrollview* scrollview; @end diff --git a/ManagerDemo/MainView/HomeView/HomeAdView.m b/ManagerDemo/MainView/HomeView/HomeAdView.m index 87bb00c..12783f4 100644 --- a/ManagerDemo/MainView/HomeView/HomeAdView.m +++ b/ManagerDemo/MainView/HomeView/HomeAdView.m @@ -7,7 +7,6 @@ // #import "HomeAdView.h" -#import "HDScrollview.h" @implementation HomeAdView { NSArray *imageArray; @@ -55,27 +54,6 @@ } */ -#pragma mark ==========UIScrollViewDelegate============ - -- (void)scrollViewDidScroll:(UIScrollView *)sender -{ - // disable v direction scroll - - [_scrollview HDscrollViewDidScroll]; - - -} -- (void)scrollViewDidEndDecelerating:(UIScrollView *)_scrollView -{ - [_scrollview HDscrollViewDidEndDecelerating]; -} --(void)TapView:(int)index -{ - DLog(@"点击了第%d个页面",index); - //下面可以根据自己的需求操作 - //Example - -} #pragma mark ImagePlayerDelegate - (void)imagePlayerView:(ImagePlayerView *)imagePlayerView loadImageForImageView:(UIImageView *)imageView index:(NSInteger)index {