网格

作者: 老公123 | 来源:发表于2018-09-21 10:23 被阅读0次

#import "oneViewController.h"

#import "twoViewController.h"

@interface oneViewController ()<UICollectionViewDelegate,UICollectionViewDataSource>{

    UICollectionView *clv;

}

@end

@implementationoneViewController

- (void)viewDidLoad {

    [super viewDidLoad];

    self.view.backgroundColor=[UIColor whiteColor];

    [selfSetNav];

    [selfSetUser];

    [selfSetClv];

}

- (void)SetNav{

    self.navigationItem.title=@"月考";

    self.navigationController.navigationBar.barTintColor=[UIColor lightGrayColor];

}

- (void)SetUser{

    UIButton*UserBtn=[[UIButtonalloc]initWithFrame:CGRectMake(0,80,150,40)];

    [UserBtnsetTitle:@"用户名字" forState:UIControlStateNormal];

    [UserBtnsetFont:[UIFont systemFontOfSize:20]];

    [UserBtnsetTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

    [UserBtnaddTarget:self action:@selector(TZhuanClick) forControlEvents:UIControlEventTouchUpInside];

    [self.viewaddSubview:UserBtn];

    [self.viewaddSubview:UserBtn];

    UIImageView *TouImg=[[UIImageView alloc]initWithFrame:CGRectMake(300, 80, 60, 60)];

    TouImg.image=[UIImageimageNamed:@"QQicon"];

    TouImg.layer.cornerRadius=25;

    TouImg.layer.masksToBounds=YES;

    [self.viewaddSubview:TouImg];

}

- (void)SetClv{

    UILabel*ServiceLab=[[UILabelalloc]initWithFrame:CGRectMake(30,200,100,30)];

    ServiceLab.text=@"服务";

    [self.viewaddSubview:ServiceLab];

    UICollectionViewFlowLayout *Flow=[[UICollectionViewFlowLayout alloc]init];

    clv=[[UICollectionView alloc]initWithFrame:CGRectMake(0, 250, self.view.frame.size.width, 320) collectionViewLayout:Flow];

    Flow.itemSize=CGSizeMake(100,100);

    clv.delegate=self;

    clv.dataSource=self;

    [clv registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"cell"];

    clv.backgroundColor=[UIColor whiteColor];

    [self.view addSubview:clv];

}

- (NSInteger)collectionView:(UICollectionView*)collectionView numberOfItemsInSection:(NSInteger)section{

    return 8;

}

- (UICollectionViewCell*)collectionView:(UICollectionView*)collectionView cellForItemAtIndexPath:(NSIndexPath*)indexPath{

    UICollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];

    NSArray *ArrImg=@[@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12"];

    NSArray *ArrLab=@[@"红包年卡",@"我的行程",@"我的消息",@"我的客服",@"保修助手",@"ofo助手",@"邀请好友",@"天使的蛋生"];

    UIImageView *ClvImg=[[UIImageView alloc]initWithFrame:CGRectMake(10, 0, 70, 70)];

    UILabel *ClvLab=[[UILabel alloc]initWithFrame:CGRectMake(10, 70, 100, 20)];

    ClvLab.text=ArrLab[indexPath.row];

    ClvImg.image=[UIImageimageNamed:ArrImg[indexPath.row]];

    [celladdSubview:ClvImg];

    [celladdSubview:ClvLab];

    returncell;

}

- (void)TZhuanClick{

    twoViewController *two=[[twoViewController alloc]init];

    [self.navigationController pushViewController:two animated:YES];

}

@end

相关文章

  • CSS Grid Auto

    关键词:隐式轨道 / 隐式网格 / 自动布局算法 隐式网格 隐式网格是指当网格项目确认在显式网格之外时所创建的网格...

  • GridLayout网格布局

    网格术语 网格线(Grid Lines)网格线组成了网格,他是网格的水平和垂直的分界线。一个网格线存在行或列的两侧...

  • 铜沛

    铜沛网格 铜沛网格

  • 九宫格拖拽

    效果实例 简单了解Grid布局(网格布局) 什么是网格布局 CSS网格布局(又称“网格”),是一种二维网格布局系统...

  • 九宫格拖拽

    效果实例 简单了解Grid布局(网格布局) 什么是网格布局 CSS网格布局(又称“网格”),是一种二维网格布局系统...

  • 网格

    遵守网格的协议 创建网格

  • 11月24日4D分享

    A:加班整理网格基础数据,网格人员表示很无奈,不认可。 M:很郁闷。 B:网格人员被我留下来加班整理网格的基础数据...

  • 10月17日4D8B分享

    A:本日对本网格行销团队在其他网格行销是否回自己网格行销事情纠结不清,无法和网格经理达成一直。 M:心中纠结,难以...

  • 民健社区网格长的一天

    小网格,释放大能量。社区矛盾调解、安全检查,环境整治、小广告清理、网格巡查等诸多事项,无不由网格长协调网格员处理。...

  • 网格化的前世今生

    作者:丁野菠 江安警官学院社会治理专业资深讲师 现在谈到社会治理必谈网格化,还有网格员、网格长、总网格长...

网友评论

      本文标题:网格

      本文链接:https://www.haomeiwen.com/subject/oahanftx.html