zoukankan      html  css  js  c++  java
  • 20141211笔记(UIImageView 设置内容的Mode的方法UICollectionViewCell Custom的方法ios modal segue code)

    1、UIImageView 设置内容的Mode的方法
    imageView.contentMode = UIViewContentModeScaleAspectFill;

    2、UICollectionViewCell Custom的方法
    CustomUICollectionViewCell.m
    - (id)initWithFrame:(CGRect)frame{
        if (self = [super initWithFrame:frame]) {
            [self initUI];
        }
        return self;
    }
    - (void)initUI{ 
      //TODO }

    然后在collectionView中注册这个CustomUICollectionViewCell

      UICollectionViewFlowLayout* flowLayout = [[UICollectionViewFlowLayout alloc]init];
        collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:flowLayout];
        [collectionView setTranslatesAutoresizingMaskIntoConstraints:NO];
        [collectionView setBackgroundColor:[UIColor clearColor]];
        [collectionView registerClass:[CustomCollectionViewCell class] forCellWithReuseIdentifier:@"MY_CELL"];
        collectionView.dataSource = self;
        collectionView.delegate = self;

    最后在datasource函数中复用Cell

    - (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath {
        CustomCollectionViewCell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"MY_CELL" forIndexPath:indexPath];
        
        return cell;
    }

    这就是CollectionViewCell的Custom流程

    3、ios modal segue code

    - (IBAction)pushMyNewViewController
    {
        MyNewViewController *myNewVC = [[MyNewViewController alloc] init];
    
        // do any setup you need for myNewVC
    
        [self presentModalViewController:myNewVC animated:YES];//被弃用

        [self presentViewController:viewController animated:YES completion:nil];//被这个代替

    }

    [self dismissViewControllerAnimated:YES completion:nil];  //dismiss view

     
  • 相关阅读:
    动态规划----查找一个数组中存在的数学数列
    java数据结构和算法------第八章
    java数据结构和算法-----第七章
    04002_HTML表单
    雷林鹏分享:PHP 高级过滤器
    雷林鹏分享:Lua 函数
    雷林鹏分享:Lua 流程控制
    雷林鹏分享:Lua 循环
    雷林鹏分享:Lua 变量
    雷林鹏分享:Lua 数据类型
  • 原文地址:https://www.cnblogs.com/scaptain/p/4156553.html
Copyright © 2011-2022 走看看