【发布时间】:2012-04-18 09:49:29
【问题描述】:
基本的分隔符看起来很简单并且是一维的,但是大多数表格视图都有很好看的分隔符,我觉得它看起来不错,因为它有阴影或使它看起来像 3D 的东西。他们是怎么做到的?
【问题讨论】:
标签: iphone objective-c uitableview
基本的分隔符看起来很简单并且是一维的,但是大多数表格视图都有很好看的分隔符,我觉得它看起来不错,因为它有阴影或使它看起来像 3D 的东西。他们是怎么做到的?
【问题讨论】:
标签: iphone objective-c uitableview
您可以通过编程方式/XIB 创建您的表格。 现在在您的代码或 XIB 集中:
yourTable.separatorStyle=UITableViewCellSeparatorStyleNone;
现在在 tableview 委托方法中:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:Identifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:businessLogicIdentifier]
autorelease];
customSeperator=[[UIView alloc]initWithFrame:CGRectMake(0, (cell.frame.origin.y), 320, 1)];
customSeperator.backgroundColor=[UIColor lightGrayColor];
[cell.contentView addSubview:customSeperator];
}
现在在线 (customSeperator.backgroundColor=[UIColor lightGrayColor];) 你也可以试试
[UIColor colorWithPatternImage:[UIImage imageNamed:@"myimage.png"]];
用于使用您自己的图像。 希望对你有帮助
【讨论】: