- (UIbutton *)makeheaderbutton { UIbutton *button = [UIbutton buttonWithType:UIbuttonTypeCustom]; UIFont *textFont = [UIFont boldSystemFontOfSize:12]; UIcolor *textcolor = [UIcolor colorWithRed:80/255.0 green:109/255.0 blue:145/255.0 Alpha:1.0]; UIcolor *backgroundcolor = [UIcolor colorWithRed:250/255.0 green:250/255.0 blue:250/255.0 Alpha:1.0]; [button setTitlecolor:textcolor forState:UIControlStatenormal]; button.TitleLabel.Font = textFont; button.autoresizesSubvIEws = YES; button.layer.cornerRadius = 8; button.layer.borderWIDth = 1; // next 2 propertIEs set using QuartzCore class,no other way to set button colors button.layer.bordercolor = [UIcolor graycolor].CGcolor; button.layer.backgroundcolor = backgroundcolor.CGcolor; button.clipsToBounds = YES; return button;}
如何使这些按钮像常规的圆形按钮一样突出显示?
解决方法 在你的代码中,添加一行button.showstouchWhenHighlighted = TRUE; 总结以上是内存溢出为你收集整理的ios – 自定义UIButton触摸时不突出显示全部内容,希望文章能够帮你解决ios – 自定义UIButton触摸时不突出显示所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)