如何在我的文本框和按钮(如Foursquare应用)周围绘制圆角矩形 [英] How can I draw Rounded Rectangles around my textfields and buttons like Foursquare app

查看:87
本文介绍了如何在我的文本框和按钮(如Foursquare应用)周围绘制圆角矩形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何像Foursquare iPhone应用程序一样在所有按钮和文本字段后面绘制背景?看到显示与...共享"的地方

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

推荐答案

通过更改视图支持CALayer的cornerRadius属性,可以在任何视图上实现圆角.要访问这些属性,必须链接到QuartzCore框架.

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;

只需确保将<QuartzCore/QuartzCore.h>添加到您的项目中,然后将其添加#import.

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

这篇关于如何在我的文本框和按钮(如Foursquare应用)周围绘制圆角矩形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆