1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- //
- // ChildSymbolVC.m
- // jiaPei
- //
- // Created by apple on 16/1/5.
- // Copyright © 2016年 JCZ. All rights reserved.
- //
- #import "ChildSymbolVC.h"
- #import "symbolCollectionCell.h"
- #import "markInfo.h"
- #import "DB_Que_Helper.h"
- #import "DetailMarkVC.h"
- @interface ChildSymbolVC ()<UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
- {
- NSArray *marksArray;
- }
- @end
- @implementation ChildSymbolVC
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.view.backgroundColor = [UIColor whiteColor];
- [self configNavigationBar];
- NSArray *titleArray = @[@"禁令标志",@"警告标志",@"指示标志",@"指路标志",@"道路施工安全标志",@"旅游区标志",@"辅助标志",@"禁止标线",@"警告标线",@"指示标线",@"道路安全设施设置",@"汽车仪表盘指示灯",@"新版交警手势",@"车内功能按键",@"交通事故责任认定图解",@"色盲测试图集",];
- self.title = titleArray[_rowTag];
-
- marksArray = [[NSArray alloc] init];
- marksArray = [DB_Que_Helper queryDetailMark:[NSString stringWithFormat:@"MI_GTOUP = %@ and MI_TYPE = %@",_MI_GROUP,_MI_TYPE]];
-
- [self myInit];
- }
- -(void)myInit
- {
- UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
- [layout setScrollDirection:UICollectionViewScrollDirectionVertical];
- layout.itemSize = SGSizeMake(150, 150);
- layout.sectionInset = UIEdgeInsetsMake(5, 5, 5, 5);
- UICollectionView *collection = [[UICollectionView alloc] initWithFrame:kFrame collectionViewLayout:layout];
- collection.height -= kNavOffSet;
- collection.dataSource = self;
- collection.delegate = self;
- collection.backgroundColor = backGroundColor;
-
-
- [self.view addSubview:collection];
-
- [collection registerClass:[symbolCollectionCell class] forCellWithReuseIdentifier:@"cell"];
- }
- #pragma mark collction delegate
- - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
- {
- return marksArray.count;
- }
- - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
- {
- symbolCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
- markInfo *info = marksArray[indexPath.row];
- //如果图片名字不对 可以在这里处理
- if ([info.imageName rangeOfString:@" 1-1-"].location != NSNotFound)
- {
- info.imageName = [info.imageName substringFromIndex:1];
- }
- cell.image.image = [UIImage imageNamed:info.imageName];
- cell.nameLabel.text = info.title;
- return cell;
- }
- -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
- {
- DetailMarkVC *detail = [[DetailMarkVC alloc] init];
- detail.dataArray = marksArray;
- detail.markTag = indexPath.row;
- [self navPushHideTabbarToVC:detail];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- /*
- #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.
- }
- */
- @end
|