UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setFrame:CGRectMake(btnX, btnY, btnWidth, btnHeight)];
button.layer.borderWidth = 1; // 边框宽度设置为1
[button setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft]; // 左对齐
时间: 2024-12-12 17:03:53