| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767 |
- //
- // SearchViewController.m
- // iShop
- //
- // Created by Rui Zhang on 1/24/24.
- //
- #import "SearchViewController.h"
- #import "RAUtils.h"
- #import "RANetwork.h"
- #import "CatalogCellSmall.h"
- #import "const.h"
- #import "FileCache.h"
- #import "CatalogModelDetailViewController.h"
- #define PAGE_ITEM 30
- @interface SearchViewController ()
- @property (nonatomic,strong) NSOperationQueue *dataOperationQueue;
- @end
- @implementation SearchViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.searchBar.backgroundImage = [UIImage new];
- // Do any additional setup after loading the view.
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- - (NSOperationQueue *)dataOperationQueue {
- if (!_dataOperationQueue) {
- _dataOperationQueue = [[NSOperationQueue alloc] init];
- _dataOperationQueue.maxConcurrentOperationCount = 1;
- }
- return _dataOperationQueue;
- }
- -(void) operation_loadMore
- {
- if (self.dataOperationQueue.operationCount > 1) {
- return;
- }
- dispatch_async(dispatch_get_main_queue(), ^{
-
- if(self.loadall)
- {
- if(self.showalert)
- {
- self.showalert=false;
-
- [RAUtils message_box:@"Loading items" message:@"All loaded" completion:nil];
- }
- return;
- }
-
- self.mum.hidden = false;
- [self.mum startAnimating];
- self.mum.center = self.view.center;
-
- self.isrefreshing=true;
-
- [RANetwork request_search:self.offset limit:PAGE_ITEM keywords:self.keywords matchfull:self.loadmore_matchfull completionHandler:^(NSMutableDictionary *result) {
- NSMutableDictionary* category_more=result;
-
- [self.mum stopAnimating];
- self.isrefreshing=false;
- if (self.dataOperationQueue.operationCount > 1) {
- return;
- }
-
- NSDictionary* more_items=[category_more objectForKey:@"items"];
- if([[category_more valueForKey:@"result"] intValue]==2)
- {
- // self.category_data = category_data;
- NSMutableDictionary* items_json= [[self.category_data objectForKey:@"items"] mutableCopy];
-
- int count =[[more_items valueForKey:@"count"] intValue];
- for(int i=0;i<count;i++)
- {
-
- NSDictionary * item_json = [more_items objectForKey:[NSString stringWithFormat:@"item_%d",i]];
- [items_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%ld",i+self.offset]];
-
-
- }
- long newcount=[[[self.category_data objectForKey:@"items"] valueForKey:@"count"] intValue]+count;
- [items_json setValue: [NSString stringWithFormat:@"%ld",newcount] forKey:@"count"];
- [self.category_data setObject:items_json forKey:@"items"];
- self.offset+=count;
- if(count<PAGE_ITEM)
- {
- self.loadall=true;
-
- }
- // NSDictionary * item_json = [self.category_data objectForKey:@"items"];
-
-
-
-
- // DebugLog(@"%@",self.category_data);
-
- [self.collectionview reloadData];
-
- }
- else
- {
- [RAUtils message_box:@"Search" message:[category_more valueForKey:@"err_msg"] completion:nil];
- }
- self.isrefreshing=false;
-
-
- }];
-
- return;
-
-
- });
- }
- -(void) loadMore {
- __weak typeof(self) weakself = self;
- NSBlockOperation *operation = [NSBlockOperation blockOperationWithBlock:^{
-
- if (weakself) {
- __strong typeof(weakself) strongself = weakself;
- [strongself operation_loadMore];
- }
-
- }];
-
- [self.dataOperationQueue addOperation:operation];
- }
- -(void) operation_reload
- {
- if (self.dataOperationQueue.operationCount > 1) {
- return;
- }
- dispatch_async(dispatch_get_main_queue(), ^{
- if(self.isrefreshing)
- return;
- self.showalert=true;
- self.isrefreshing=true;
- self.loadall = false;
- UIRefreshControl *reF = (UIRefreshControl *)[self.collectionview viewWithTag:200];
-
- [reF endRefreshing];
-
- reF.attributedTitle = [[NSAttributedString alloc]initWithString:@"Pull to refresh"];
- self.label_net_err.hidden=true;
- self.collectionview.hidden=true;
- self.mum.center = self.view.center;
- self.mum.hidden = false;
- [self.mum startAnimating];
- self.loadmore_matchfull = false;//self.switch_matchfull.isOn;
- [RANetwork request_search:0 limit:PAGE_ITEM keywords:self.keywords
- matchfull:self.loadmore_matchfull completionHandler:^(NSMutableDictionary *result) {
- NSMutableDictionary* category_data=result;
-
-
- [self.mum stopAnimating];
- self.isrefreshing=false;
- if (self.dataOperationQueue.operationCount > 1) {
- return;
- }
-
- self.category_data = [category_data mutableCopy];
- [self.collectionview reloadData];
-
- if([[category_data valueForKey:@"result"] intValue]==2)
- {
- self.collectionview.hidden=false;
- NSDictionary * item_json = [self.category_data objectForKey:@"items"];
- self.offset =[[item_json valueForKey:@"count"] intValue];
-
- int total = [[self.category_data valueForKey:@"item_total_count"]intValue];
-
-
- }
- else if([[category_data valueForKey:@"result"] intValue]==RESULT_NET_ERROR)
- {
- self.collectionview.hidden=true;
- self.label_net_err.hidden=false;
- }
- else
- {
-
- [RAUtils message_box:@"Search" message:[category_data valueForKey:@"err_msg"] completion:nil];
- }
-
- self.isrefreshing=false;
-
-
- }];
-
- return;
-
-
- });
- }
- -(void) reload {
- __weak typeof(self) weakself = self;
- NSBlockOperation *operation = [NSBlockOperation blockOperationWithBlock:^{
-
- if (weakself) {
- __strong typeof(weakself) strongself = weakself;
- [strongself operation_reload];
- }
-
- }];
-
- [self.dataOperationQueue addOperation:operation];
- }
- - (IBAction)onChangeDisplay:(UIButton *)sender {
- UICollectionViewFlowLayout *flowLayout =(UICollectionViewFlowLayout*)[self.collectionview collectionViewLayout];
-
- flowLayout.scrollDirection= UICollectionViewScrollDirectionVertical;
-
-
- if(sender.tag==2&&self.categoryViewType != CATEGORY_VIEWTYPE_SMALL)
- {
- self.categoryViewType = CATEGORY_VIEWTYPE_SMALL;
- // [self.collectionview.collectionViewLayout invalidateLayout];
- // DebugLog(@"frame %f",self.collectionview.frame.size.height);
- // DebugLog(@"offset %f",self.self.collectionview.contentOffset.y);
- // DebugLog(@"content %f",self.collectionview.contentSize.height);
- // float pos =self.collectionview.contentOffset.y/self.collectionview.contentSize.height;
- [self.collectionview reloadData];
-
-
-
- [self.btnDisplay setImage:[UIImage imageNamed:@"24_layout_list"] forState:UIControlStateNormal];
-
-
- sender.tag=4;
-
- // CGPoint offset = self.collectionview.contentOffset;
- // offset.y=pos*self.collectionview.contentSize.height;
- // self.collectionview.contentOffset=offset;
-
- }
-
- else if(sender.tag==4&&self.categoryViewType != CATEGORY_VIEWTYPE_LIST)
- {
- self.categoryViewType = CATEGORY_VIEWTYPE_LIST;
-
- // DebugLog(@"frame %f",self.collectionview.frame.size.height);
- // DebugLog(@"offset %f",self.self.collectionview.contentOffset.y);
- // DebugLog(@"content %f",self.collectionview.contentSize.height);
-
- // float pos =self.collectionview.contentOffset.y/self.collectionview.contentSize.height;
-
- // [self.collectionview reloadData];
- // [self.collectionview.collectionViewLayout invalidateLayout];
-
- [self.collectionview reloadData];
-
- [self.btnDisplay setImage:[UIImage imageNamed:@"24_layout_grid"] forState:UIControlStateNormal];
- sender.tag=2;
- // CGPoint offset = self.collectionview.contentOffset;
- // offset.y=pos*self.collectionview.contentSize.height;
- // self.collectionview.contentOffset=offset;
- //
- // self.collectionview move
- }
-
-
-
- [self showCategory];
-
-
-
-
-
-
-
- // [self showCategory];
- }
- -(void) showCategory
- {
- if(self.showDetail==false)
- return;
- // UIInterfaceOrientation orientation =[UIApplication sharedApplication].statusBarOrientation;
- // int width=175;
- // // int height;
- // if(orientation == UIDeviceOrientationLandscapeLeft ||orientation == UIDeviceOrientationLandscapeRight)
- // {
- // width = 370;
- // // height = 400;
- // }
- // else
- // {
- // // height = 300;
- // width = 175;
- // }
- //
-
- CGRect frame = CGRectMake(0, 48, self.view.bounds.size.width
- , self.view.bounds.size.height-48);
-
- [UIView animateWithDuration:0.5 animations:^{ self.collectionview.frame=frame;
- }];
- self.collectionview.autoresizingMask = self.collectionview.autoresizingMask | UIViewAutoresizingFlexibleWidth;
-
- self.showDetail = false;
- // self.cagegoryLabel.hidden = false;
-
- }
- #pragma mark - searchBar delegate;
- - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
- {
-
-
- self.keywords=searchBar.text;
- self.offset = 0;
- // [self.content_data removeAllObjects];
- [self reload];
- DebugLog(@"search");
-
- [self.view endEditing:true];
- // [self.searchBar.searchTextField endEditing:true];
- }
- - (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar
- {
- self.maskView.hidden =false;
- }
- - (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar
- {
- self.maskView.hidden =true;
- }
- // - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
- // {
- //
- // if(searchText.length == 0)
- // [self.view endEditing:true];
- //
- // }
- - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
- [[self view] endEditing:YES];
- }
- //- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar
- //{
- //
- //}
- #pragma mark -- UICollectionViewDataSource
- -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
- {
- // 每个Section的item个数
- NSDictionary * item_json = [self.category_data objectForKey:@"items"];
- int count =[[item_json valueForKey:@"count"] intValue];
- return count;
-
- }
- -(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
- {
- return 1;
- }
- -(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
- {
- // NSString* value =[DefaultAppearance get_noneappearance_value:@"CategoryViewController" valuename:@"cell_border_color"];
- //
- // if(value==nil)
- // value=@"";
- // unsigned long color = strtoul([value UTF8String],0,16);
-
-
- if(self.categoryViewType == CATEGORY_VIEWTYPE_SMALL)
- {
- static NSString * CellIdentifier = @"CatalogCellSmall";
- CatalogCellSmall * cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
- NSDictionary * item_json =[[self.category_data objectForKey:@"items" ] objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
-
- NSString* description =[item_json valueForKey:@"description"];
-
- NSString* name =[item_json valueForKey:@"fash_name"];
-
- // bool wish_exist = [[item_json valueForKey:@"wish_exists"]boolValue];
- // bool cart_exists = [[item_json valueForKey:@"cart_exists"]boolValue];
- bool closeout = [[item_json valueForKey:@"is_closeout"]boolValue];
- // BOOL more_color = [[item_json valueForKey:@"more_color"] boolValue];
- // cell.mark_moreColor.hidden = !more_color;
- // if(wish_exist)
- // cell.mark_wish.hidden=false;
- // else
- // cell.mark_wish.hidden=true;
- // if(cart_exists)
- // cell.mark_order.hidden=false;
- // else
- // cell.mark_order.hidden=true;
- // if(closeout)
- // cell.mark_closeout.hidden=false;
- // else
- // cell.mark_closeout.hidden=true;
- // NSString* old_price =[item_json valueForKey:@"old_price"];
- // NSString* price =[item_json valueForKey:@"price"];
-
-
-
- if(closeout)
- cell.ic_closeout.hidden=false;
- else
- cell.ic_closeout.hidden=true;
- bool checked =[[item_json valueForKey:@"checked"] boolValue];
-
-
-
- if(!checked)
- {
-
- // cell.checkImageView.hidden = true;
- [cell setBackgroundColor:[UIColor whiteColor]/* UIColorFromRGB(0x996633)*/];
- }
- else
- {
- // cell.checkImageView.hidden = false;
- [cell setBackgroundColor: UIColorFromRGB(0x009966)];
- }
-
-
- cell.nameLabel.text = description;
- cell.modelNoLabel.text=name;
-
-
-
- // cell.cellDescription.text = description;
- // cell.oldPrice.text = old_price;
- // cell.Price.text = price;
-
-
- // cell.layer.borderColor = UIColorFromRGB(color).CGColor;
- cell.layer.borderWidth = 0.4;
- cell.layer.cornerRadius=15;
- cell.layer.masksToBounds=true;
-
- #ifdef BUILD_UWAVER
-
- cell.mark_wish.hidden = YES;
- cell.mark_order.hidden = YES;
- cell.mark_closeout.hidden = YES;
- cell.mark_moreColor.hidden = YES;
-
- #endif
-
- return cell;
- }
-
- else
- {
- static NSString * CellIdentifier = @"CatalogCellList";
- CatalogCellSmall * cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
- NSDictionary * item_json =[[self.category_data objectForKey:@"items" ] objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
- NSString* description =[item_json valueForKey:@"description"];
-
- NSString* name =[item_json valueForKey:@"fash_name"];
-
-
- // bool wish_exist = [[item_json valueForKey:@"wish_exists"]boolValue];
- // bool cart_exists = [[item_json valueForKey:@"cart_exists"]boolValue];
- bool closeout = [[item_json valueForKey:@"is_closeout"]boolValue];
- // BOOL more_color = [[item_json valueForKey:@"more_color"] boolValue];
-
-
-
- if(closeout)
- cell.ic_closeout.hidden=false;
- else
- cell.ic_closeout.hidden=true;
-
- // NSString* old_price =[item_json valueForKey:@"old_price"];
- // NSString* price =[item_json valueForKey:@"price"];
-
-
-
- // bool checked =[[item_json valueForKey:@"checked"] boolValue];
-
-
-
-
- cell.nameLabel.text = description;
- cell.modelNoLabel.text=name;
-
-
- // cell.cellDescription.text = description;
- // cell.oldPrice.text = old_price;
- // cell.Price.text = price;
-
- // cell.layer.borderColor = UIColorFromRGB(color).CGColor;
- cell.layer.borderWidth = 0.2;
- //cell.layer.cornerRadius=15;
- cell.layer.masksToBounds=true;
-
- #ifdef BUILD_UWAVER
-
- cell.mark_wish.hidden = YES;
- cell.mark_order.hidden = YES;
- cell.mark_closeout.hidden = YES;
- cell.mark_moreColor.hidden = YES;
-
- #endif
-
- return cell;
- }
- }
- - (void)collectionCell:(CatalogCellSmall *)cell setImageForIndexPath:(NSIndexPath *)indexPath {
-
- NSDictionary * item_json =[[self.category_data objectForKey:@"items" ] objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
- NSString* img_url =[item_json valueForKey:@"img"];
-
-
- NSString *loading = @"loading_l";
- NSString *notFound = @"notfound_l";
-
- if (self.categoryViewType == CATEGORY_VIEWTYPE_LARGE) {
-
- loading = @"loading_l";
- notFound = @"notfound_l";
- img_url =[item_json valueForKey:@"img_big"]; // large 大图
-
- } else if (self.categoryViewType == CATEGORY_VIEWTYPE_SMALL) {
-
- loading = @"loading_s";
- notFound = @"notfound_s";
- img_url =[item_json valueForKey:@"img"]; // large 大图
-
- }
- NSString* file_name=[img_url lastPathComponent];
- if (![cell.imageName isEqualToString:img_url]) {
- cell.imageName = img_url;
- cell.cellImageView.image = [UIImage imageNamed:loading];
- NSData* img_data=[FileCache load_cached_img:file_name loadFrom:img_url];
- if(img_data!=nil)
- {
-
- UIImage * img =[UIImage imageWithData:img_data];
- cell.cellImageView.image = img;
- }
- else
- {
- DebugLog(@"load image");
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-
- NSData* downloadimg_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:img_url]];
-
- dispatch_async(dispatch_get_main_queue(), ^{
-
-
-
- if(downloadimg_data!=nil)
- {
-
- [FileCache cache_img:downloadimg_data filename:file_name saveTo:img_url];
-
- UIImage * img =[UIImage imageWithData:downloadimg_data];
- cell.cellImageView.image = img;
- }
- else
- cell.cellImageView.image = [UIImage imageNamed:notFound];
-
- });
- });
-
-
- }
- }
-
- }
- - (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {
-
- CatalogCellSmall * son_cell = (CatalogCellSmall *)cell;
- son_cell.imageName = nil;
- [self collectionCell:son_cell setImageForIndexPath:indexPath];
- }
- - (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {
-
- CatalogCellSmall * son_cell = (CatalogCellSmall *)cell;
-
- NSString *loading = @"loading_l";
-
- if (self.categoryViewType == CATEGORY_VIEWTYPE_LARGE) {
-
- loading = @"loading_l";
-
- } else if (self.categoryViewType == CATEGORY_VIEWTYPE_SMALL) {
-
- loading = @"loading_s";
-
- }
-
- son_cell.cellImageView.image = [UIImage imageNamed:loading];
- }
- #pragma mark --UICollectionViewDelegateFlowLayout
- ////定义每个UICollectionView 的大小
- //- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
- //{
- // return CGSizeMake(96, 100);
- //}
- //定义每个UICollectionView 的 margin
- - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
- {
-
- if(self.categoryViewType ==CATEGORY_VIEWTYPE_LIST)
- return CGSizeMake(self.view.frame.size.width, 80);
- return CGSizeMake((self.view.frame.size.width-30)/2, 251);
-
-
- }
- - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
- {
- if(self.categoryViewType ==CATEGORY_VIEWTYPE_LIST)
- return 0;
- return 10;
- }
- -(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
- {
- if(self.showDetail)
- return UIEdgeInsetsMake(10, 5, 10, 5);
- if(self.categoryViewType ==CATEGORY_VIEWTYPE_LARGE)
- return UIEdgeInsetsMake(10, 10, 10, 10);
- else if(self.categoryViewType ==CATEGORY_VIEWTYPE_LIST)
- return UIEdgeInsetsMake(10, 0, 10, 0);
- return UIEdgeInsetsMake(10, 10, 10, 10);
-
-
- return UIEdgeInsetsMake(10, 10, 10, 10);
- }
- #pragma mark --UICollectionViewDelegate
- -(void) showDetailat:(NSString*) item_id category_id:(NSString*) category_id name:(NSString *)name index:(long)index
- {
-
-
- CatalogModelDetailViewController* dvc = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"CatalogModelDetailViewController" ];
-
- dvc.OnBack=^(bool add_cart,bool add_wish,bool update_data)
- {
-
-
- NSMutableDictionary* items =[[self.category_data objectForKey:@"items"] mutableCopy];
-
- NSMutableDictionary* item = [[items objectForKey:[NSString stringWithFormat:@"item_%ld",index]] mutableCopy];
- if(add_cart)
- item[@"cart_exists"]=@"true";
- if(add_wish)
- item[@"wish_exists"]=@"true";
- items[[NSString stringWithFormat:@"item_%ld",index]] = item;
- self.category_data[@"items"]=items;
- [self.collectionview reloadData];
- };
- dvc.product_id = item_id;
- dvc.category_id=category_id;
- dvc.ispush = true;
- dvc.model_name = name;
-
- [dvc reload];
- [self.navigationController pushViewController:dvc animated:true];
- return;
-
-
-
- }
- //UICollectionView被选中时调用的方法
- -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
- {
- NSMutableDictionary* items =[[self.category_data objectForKey:@"items"] mutableCopy];
-
- NSMutableDictionary* item = [[items objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]] mutableCopy];
-
- // if(self.isSelectionMode)
- // {
- // bool checked =[[item valueForKey:@"checked"] boolValue];
- //
- // CategoryCellNPD *currentSelecteCell = (CategoryCellNPD *)[self.collectionview cellForItemAtIndexPath:indexPath];
- //
- //
- // if(checked)
- // {
- // self.select_count--;
- // if(self.select_count==0)
- // {
- // // self.addWishBtn.enabled = false;
- // // self.addCartBtn.enabled = false;
- // // self.addPortfolioBtn.enabled=false;
- // }
- // [item setValue:@"false" forKey:@"checked"];
- //
- // currentSelecteCell.checkImageView.hidden = true;
- // if(self.categoryViewType != CATEGORY_VIEWTYPE_LIST)
- // [currentSelecteCell setBackgroundColor: [UIColor whiteColor]];
- // else
- // [currentSelecteCell setBackgroundColor: [UIColor whiteColor]];
- // }
- // else
- // {
- // self.select_count++;
- // // self.addWishBtn.enabled = true;
- // // self.addCartBtn.enabled = true;
- // // self.addPortfolioBtn.enabled=true;
- // [item setValue:@"true" forKey:@"checked"];
- // currentSelecteCell.checkImageView.hidden = false;
- // [currentSelecteCell setBackgroundColor: UIColorFromRGB(0x009966)];
- // }
- // [items setObject:item forKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]];
- // [self.category_data setObject:items forKey:@"items"];
- //
- //
- // }
- // else
- {
- NSString* detail_id = [NSString stringWithFormat:@"%@",[item valueForKey:@"product_id"]];
-
- [self showDetailat:detail_id category_id:nil name:[item objectForKey:@"fash_name"] index:indexPath.row];
- }
-
- }
- @end
|