// // HBImageViewList.m // MyTest // // Created by weqia on 13-7-31. // Copyright (c) 2013年 weqia. All rights reserved. // #import "HBImageViewList.h" @implementation HBImageViewList @synthesize imageViews=_imageViews; #pragma -mark 覆盖父类的方法 - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization code self.backgroundColor=[UIColor blackColor]; self.pagingEnabled=YES; self.delegate=self; _prePage=0; _tapOnceAction=nil; _target=nil; self.showsHorizontalScrollIndicator=NO; self.showsVerticalScrollIndicator=NO; _pageControl=[[UIPageControl alloc]initWithFrame:CGRectZero]; _pageControl.pageIndicatorTintColor=[UIColor lightGrayColor]; _pageControl.currentPageIndicatorTintColor=[UIColor whiteColor]; _pageControl.hidesForSinglePage=YES; [_pageControl addTarget:self action:@selector(pageChangeAction) forControlEvents:UIControlEventValueChanged]; } return self; } -(void)didMoveToSuperview { [_pageControl sizeToFit]; CGRect frame=_pageControl.frame; frame.origin.x=(self.frame.size.width-frame.size.width)/2; frame.origin.y= JX_SCREEN_HEIGHT - 100; _pageControl.frame=frame; [self.superview addSubview:_pageControl]; } -(void)didMoveToWindow { [_pageControl removeFromSuperview]; } #pragma -mark 接口方法 -(void)addImages:(NSArray *)images { _images=images; _imageViews=[NSMutableArray array]; NSInteger count=[_images count]; self.contentSize=CGSizeMake(self.frame.size.width*count, self.frame.size.height); for(int i=0;i