又写了一个傻逼的bug,底下closeButton一直不出来,想俩小时没想明白,看明白之后彻底无语。是不是因为屏幕高度不够啊,一直没看到这有个return
for (int i = 0; i < count1; i ++) {
if (i == 4) {
return;
}
UIButton *bgButton = [UIButton buttonWithType:UIButtonTypeCustom];
[whiteBgView addSubview:bgButton];
bgButton.frame = CGRectMake(friendEdge + (friendWidth + weEdge)*i, lineView2.bottom + 15, friendWidth, friendHeight);
NSString *imageName = [NSString stringWithFormat:@"lk_share2_%d", i];
UIImageView *avatarImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, friendWidth, friendWidth)];
avatarImageView.image = [UIImage imageNamed:imageName];
// avatarImageView.clipsToBounds = YES;
// avatarImageView.layer.cornerRadius = friendWidth/2;
[bgButton addSubview:avatarImageView];
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(-10, avatarImageView.bottom + 10, bgButton.width+20, 12)];
titleLabel.textAlignment = NSTextAlignmentCenter;
titleLabel.text = title2Array[i];
titleLabel.font = [UIFont addMyFont:@"PingFangSC-Regular" size:12];
titleLabel.textColor = [UIColor colorWithHexString:@"#5F6168"];
[bgButton addSubview:titleLabel];
}
UIButton *closeButton = [UIButton buttonWithType:UIButtonTypeCustom];
closeButton.frame = CGRectMake(0, whiteBgView.height-12-47, whiteBgView.width, 47);
[closeButton setBackgroundColor:[UIColor colorWithHexString:@"#F4F5F9"]];
[closeButton setTitle:@"取消" forState:UIControlStateNormal];
[closeButton setTitleColor:[UIColor colorWithHexString:@"#2B3346"] forState:UIControlStateNormal];
closeButton.titleLabel.font = [UIFont addMyFont:@"PingFangSC-Medium" size:14];
[closeButton addTarget:self action:@selector(doCloseButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[whiteBgView addSubview:closeButton];
网友评论