iOS 刷新
// // ViewController.m // BookStore // // Created by cyd on 14-11-21. // Copyright (c) 2014年 cyd. All rights reserved. //
#import "IndexViewController.h" #import "UIViewController+MMDrawerController.h" @interface IndexViewController ()
@end
@implementation IndexViewController int flag=0;
-
(void)viewDidLoad { ; self.navigationItem.title=@"图书列表"; // self.view.backgroundCo lor=; ; ;
; ; // SaveDataModel *saveModel=init]; // ; ; ;
}
-(void)tableViewInitShow { _refreshHeaderTableView = ; _refreshHeaderCollectionView = ; ; }
-(EGORefreshTableHeaderView *)refresh { EGORefreshTableHeaderView *egoView= initWithFrame:CGRectMake(0.0f, 0.0f - self.view.bounds.size.height, self.view.frame.size.width, self.view.bounds.size.height)]; egoView.delegate=self; ; return egoView; }
-(void)reloadTableViewDataSource { _reLoading=YES; }
-(void)doneLoadingTableViewData { _reLoading = NO; if (flag%2==0) { ; ;
}
else{
;
;
}
}
-
(void)scrollViewDidScroll:(UIScrollView *)scrollView { if (flag%2==0) ; else{ ; } }
-
(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate { if (flag%2==0) ; else{ ; } }
-
(void)egoRefreshTableHeaderDidTriggerRefresh:(EGORefreshTableHeaderView*)view {
; ;
}
-
(BOOL)egoRefreshTableHeaderDataSourceIsLoading:(EGORefreshTableHeaderView*)view {
return _reLoading;
}
-
(NSDate*)egoRefreshTableHeaderDataSourceLastUpdated:(EGORefreshTableHeaderView*)view {
return ;
}
///////////////////////////////////////////////////// -(UICollectionView *)creatCollectionView{ UICollectionViewFlowLayout *flowRight = init]; m_collectionView= initWithFrame:CGRectMake(0, 60,self.view.frame.size.width,self.view.frame.size.height) collectionViewLayout:flowRight]; m_collectionView.dataSource=self; m_collectionView.delegate=self; m_collectionView.backgroundColor = ; ; return m_collectionView; }
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return listData.count; }
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { return 1; }
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { NSString * CellIdentifier =; forCellWithReuseIdentifier:CellIdentifier]; UICollectionViewCell * cell = ; NSDictionary *group= initWithObjectsAndKeys:indexPath,@"indexpath",cell,@"cell",nil]; ;
;
return cell;
}
- (CGSize)collectionView:(UICollectionView )collectionView layout:(UICollectionViewLayout)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { return CGSizeMake(96, 100); }
-(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section { return UIEdgeInsetsMake(0, 20, 20, 20); }
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { BookInfoViewController *bookInfo=init:]; ; }
-
(CGFloat)collectionView:(UICollectionView )collectionView layout:(UICollectionViewLayout)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section { return 50; }
-
(CGFloat)collectionView:(UICollectionView )collectionView layout:(UICollectionViewLayout)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section { return 2; }
/////////////////////////////////////////////////////////////////////////////////////////////////// -(UITableView *)creatTableView { m_tableView=initWithFrame:CGRectMake(0, 60, bounds].size.width, bounds].size.height) style:UITableViewStylePlain]; m_tableView.dataSource=self; m_tableView.delegate=self; m_tableView.backgroundColor = ; ; return m_tableView; }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *identify = ; UITableViewCell *cell = ; if (cell == nil) { cell = initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identify]; } NSDictionary *group= initWithObjectsAndKeys:indexPath,@"indexpath",cell,@"cell",nil]; ; ; ; ; ; ; return cell; }
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { BookInfoViewController *bookInfo=init:]; ;
} /////////////////////////////////////////////////////////////////////////// -(void)creatLabelSpecial :(UITableViewCell *)cell :(NSIndexPath *)indexPath :(CGRect)frame :(NSString *)leftHalf :(NSString *)forkey { UILabel *bookInfo = initWithFrame:frame]; NSArray *rightHalf=objectForKey:forkey]; NSString *bookText=]; bookInfo.text=bookText; ; }
-(void)creatLabel :(UITableViewCell *)cell :(NSIndexPath *)indexPath :(CGRect)frame :(NSString *)leftHalf :(NSString *)forkey { UILabel *bookInfo = initWithFrame:frame]; NSString *rightHalf=objectForKey:forkey]; NSString *bookText=; bookInfo.text=bookText; ; } //////////////////////////////// -(void)loadImageTableView:(NSDictionary *)group { UIImageView *imageView = initWithFrame:CGRectMake(20, 2, 70, 100)]; NSData *data= row]] objectForKey:@"images"] objectForKey:@"small"]]]; UIImage *img=; imageView.image=img; addSubview:imageView]; }
-(void)creatLabelPicture :(UICollectionViewCell *)cell :(NSIndexPath *)indexPath :(CGRect)frame :(NSString *)forkey { UILabel *labelPicture = initWithFrame:frame]; NSString *pictureName=objectForKey:forkey]; labelPicture.text=pictureName; ]; labelPicture.font =; labelPicture.lineBreakMode=NSLineBreakByCharWrapping; labelPicture.numberOfLines=0; ; }
-(void)loadImageCollectionView:(NSDictionary *)group { UIImageView *imageView = initWithFrame:CGRectMake(5, 2, 70, 100)]; NSData *data= row]] objectForKey:@"images"] objectForKey:@"small"]]]; UIImage *img=; imageView.image=img; addSubview:imageView]; }
-(void)getLocalData { ReadDataModel *readData=init]; NSArray *arry=; listData=arry; NSLog(@"%@",objectForKey:@"images"]objectForKey:@"small"]); }
-
(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return ; }
-
(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 120.0; }
////////////////////////////////////////////////////////
-
(void)setupLeftMenuButton { MMDrawerBarButtonItem * leftDrawerButton = initWithTarget:self action:@selector(leftDrawerButtonPress:)]; ; }
-
(void)leftDrawerButtonPress :(id)sender { ; }
-(void)setupRightBarButon{ UIBarButtonItem *btnSave = initWithTitle:@"图片浏览" style:UIBarButtonItemStylePlain target:self action:@selector(clickBookList:)]; self.navigationItem.rightBarButtonItem = btnSave; }
-(void)clickBookList :(id)sender { if(flag%2==0){ ; //; ; ; } else { ;
} flag++; NSLog(@"%d",flag); }
- (void)didReceiveMemoryWarning { ; // Dispose of any resources that can be recreated. }
@end