iphone uibutton方角

Sat*_*yam 3 iphone uibutton

如何以编程方式在iphone app中创建UIButton以获得方角.我不想要圆角.

mcl*_*lin 10

将它的buttonType设置为UIButtonTypeCustom,这样它就不会绘制圆角矩形,然后为UIButton的图层添加边框:

//you need this import
#import <QuartzCore/QuartzCore.h>

[button.layer setBorderColor: [[UIColor blackColor] CGColor]];
[button.layer setBorderWidth: 2.0];
Run Code Online (Sandbox Code Playgroud)