UIButton *animationBtn = [UIButton buttonWithType:UIButtonTypeCustom];
animationBtn.frame = CGRectMake(x, y, width, height);
animationBtn.titleLabel.font = [UIFont boldSystemFontOfSize:10];
[animationBtn setBackgroundColor:UIColorFromRGB(0xFF8F2C)];
[animationBtn setTitle:@"免费"
forState:UIControlStateNormal];
[animationBtn setUserInteractionEnabled:NO];
animationBtn.layer.cornerRadius = 1.5;
animationBtn.layer.masksToBounds = YES;
[self.view addSubview:animationBtn];
实现效果图: