美文网首页
高类聚代码

高类聚代码

作者: Hello_World2017 | 来源:发表于2016-11-01 11:31 被阅读0次

    UICollectionViewFlowLayout *layout = ({

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

    layout.itemSize = CGSizeMake(cellWH, cellWH);

    layout.minimumInteritemSpacing = margin;

    layout.minimumLineSpacing = margin;

    layout;

    });

    UICollectionView *collectionView = ({

    UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, BSScreenW, 0) collectionViewLayout:layout];

    collectionView.dataSource = self;

    collectionView.delegate = self;

    [collectionView registerNib:[UINib nibWithNibName:NSStringFromClass([BSSquareCell class]) bundle:nil] forCellWithReuseIdentifier:ID];

    collectionView.scrollEnabled = NO;

    collectionView;

    });

    - (void)viewDidLoad {

    [super viewDidLoad];

    [self.view addSubview:({

    UIView*view = [[UIView alloc]initWithFrame:(CGRect){100,200,200,200}];

    view.backgroundColor = [UIColor redColor];

    UIButton*butaicon= [UIButton buttonWithType:UIButtonTypeCustom];

    butaicon.frame = (CGRect){75,75,50,50};

    butaicon.backgroundColor = [UIColor yellowColor];

    [butaicon setFont:[UIFont systemFontOfSize:14.0 weight:30.0]];

    [butaicon setTitleColor:[UIColor purpleColor] forState:UIControlStateNormal];

    [butaicon setTitle:@"点击" forState: UIControlStateNormal];

    [butaicon addTarget:self action:@selector(buttAcion:) forControlEvents:UIControlEventTouchUpInside];

    [view addSubview:butaicon];

    UIButton*Maxbutton = [UIButton buttonWithType:UIButtonTypeCustom];

    Maxbutton.frame = CGRectMake(0, 0, 400,600);

    Maxbutton.alpha = 0.8;

    [Maxbutton addTarget:self action:@selector(buttAcion2:) forControlEvents:UIControlEventTouchUpInside];

    [Maxbutton addSubview:view];

    Maxbutton;

    })];

    }

    相关文章

      网友评论

          本文标题:高类聚代码

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