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;
})];
}
网友评论