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

     
  • 相关阅读:
    [DDCTF 2019]homebrew event loop
    [极客大挑战 2019]FinalSQL
    $[HAOI2008]$硬币购物
    $2018/8/19 = Day5$学习笔记 + 杂题整理
    $2018/8/16 = Day2$学习笔记$+$杂题整理
    [NOIp2009] $Hankson$の趣味题
    2018清北学堂夏日培训游记
    2.数组的声明和创建
    1.什么是数组?
    15.递归
  • 原文地址:https://www.cnblogs.com/scaptain/p/4156553.html
Copyright © 2011-2022 走看看