是否可以为UITableView添加边框样式? (不是BorderColor / BorderWidth) [英] Is it possible to add a border style to a UITableView? (Not BorderColor/BorderWidth)

查看:106
本文介绍了是否可以为UITableView添加边框样式? (不是BorderColor / BorderWidth)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以为UITableView添加边框样式?

Is it possible to add a border style to a UITableView?

不仅仅是bordercolor和borderwidth。

Not just bordercolor and borderwidth.

例如凹槽边框样式?

推荐答案

嘿你可以使用 CALAYer 为你的观点提供边框,这可以在 QuartzCore Framework

Hey You can give border to your views using CALayer which is available in QuartzCore Framework

以下链接将帮助您详细了解 CALayer

Following link will help you to understand CALayer in detail.

CALayers Tutorial简介

例如,从以上链接,

// Import QuartzCore.h at the top of the file
#import <QuartzCore/QuartzCore.h>

// In viewDidLoad add the following lines
self.view.layer.backgroundColor = [UIColor orangeColor].CGColor;
self.view.layer.cornerRadius = 20.0;
self.view.layer.frame = CGRectInset(self.view.layer.frame, 20, 20);


CALayer *sublayer = [CALayer layer];
sublayer.backgroundColor = [UIColor blueColor].CGColor;
sublayer.shadowOffset = CGSizeMake(0, 5);
sublayer.shadowRadius = 5.0;
sublayer.shadowColor = [UIColor blackColor].CGColor;
sublayer.shadowOpacity = 1.0;
sublayer.frame = CGRectMake(30, 30, 128, 192);
[self.view.layer addSublayer:sublayer];

虽然上面的代码不会给你精确的沟槽效果。但你可以尝试一下。

Though above code will not give you exact grooved effect. But you can try with it.

这篇关于是否可以为UITableView添加边框样式? (不是BorderColor / BorderWidth)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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