How can I draw Rounded Rectangles around my textfields and buttons like Foursquare app

对着背影说爱祢 提交于 2019-12-22 18:46:05

问题


How can I draw a background behind all my buttons and textfields like on the Foursquare iPhone app? See where it says "Share with..."


回答1:


You can achieve rounded corners on any view by changing the cornerRadius property of the view's backing CALayer. To access these properties, you will have to link against the QuartzCore framework.

Then you can change the corner radius like this:

textFieldBackgroundView.layer.cornerRadius = 10;

Just make sure to add <QuartzCore/QuartzCore.h> to your project and #import it.



来源:https://stackoverflow.com/questions/5138996/how-can-i-draw-rounded-rectangles-around-my-textfields-and-buttons-like-foursqua

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!