1. 程式人生 > >buttontagsframe自適應寬高 2018.9.29

buttontagsframe自適應寬高 2018.9.29

  • (void)createSubView:(NextTableViewCell *)celll model:(NextModel *)modell{
  • // UIView *backView = [[UIView alloc] init];
  • // backView.frame = CGRectMake(0, 64, 250, self.view.frame.size.height-64);
  • // backView.backgroundColor = [UIColor greenColor];
  • // [self.view addSubview:backView];
  • _frame = [[TagsFrame alloc] init];
  • _frame.tagsArray = _tagsArray;
  • for (NSInteger i=0; i< modell.arrayp.count; i++) {
  • tagsBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  • [tagsBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  • [tagsBtn setTitle:modell.arrayp[i] forState:UIControlStateNormal]; tagsBtn.titleLabel.font = TagsTitleFont;
  • tagsBtn.backgroundColor = [UIColor whiteColor]; tagsBtn.layer.borderWidth = 1;
  • tagsBtn.layer.borderColor = [UIColor lightGrayColor].CGColor; tagsBtn.layer.cornerRadius = 4;
  • tagsBtn.layer.masksToBounds = YES;
  • tagsBtn.frame = CGRectFromString(_frame.tagsFrames[i]);
  • [celll.vieww addSubview:tagsBtn];
  • }
  • }