2015-10-29 28 views
-4

所以我用這個代碼:如何改變在Xcode(客觀C)幀的顏色

- (void)setFrame:(CGRect)frame { 
    frame.origin.y += 4; 
    frame.size.height -= 2 * 4; 
    [super setFrame:frame]; 
} 

我從帖子的人看到在這個網站把我的自定義細胞之間的空間。我想知道是否有辦法改變它的顏色?它目前是白色的。或者如果有辦法讓它透明?

This is how it looks like. I just want to change the color of the white frame between the cells

+0

提供一些詳細的信息? – Vijay

+1

一個框架(CGRect)實際上只是一個空間的定義。它沒有顏色。這不是一回事。一個視圖使用一個框架來定義它的位置和大小。您可以更改視圖的背景顏色。順便說一下,找到一個更新的教程。你在做什麼是非常過時的。 – Fogmeister

+0

對於你正在設置這個框架?給你一些代碼你做了什麼。 – Vijay

回答

0

我想這和它的工作:

UIView* separatorLineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 10)]; 
    separatorLineView.backgroundColor = [UIColor colorWithRed:206/255.0 green:191/255.0 blue:170/255.0 alpha:1.0]; 
    [cell.contentView addSubview:separatorLineView]; 
0

如果你想在單元格之間的色彩空間,嘗試:

tableView.backgroundColor = [UIColor clearColor]; // This should give you transparent color