UIViewに枠線を表示する

QuartzCoreを使うとUIViewに枠線を表示できます。もちろんUIViewのサブクラスであるUILabelやUIImageViewなどにもこの手法は使えます。

1. プロジェクトにCoreGraphicsライブラリを追加する

プロジェクトのSummaryから、QuartzCore.frameworkを追加します。

2. importを記述する

#import <QuartzCore/QuartzCore.h>

3. 枠線を指定する

view.layer.borderColor = [UIColor blueColor].CGColor;
view.layer.borderWidth = 1.0f;

You also need to link with QuartzCore.framework to access this functionality.

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">