I have come to a problem, wich I have no idea how to solve. Can anyone think outside the box and point me to right directions? I would be very thankfull !
The problem.
I have a UITableView containing a first row wich is always the same (a empty row with repeating background) Next rows are bounch of dynamic data rows. I have set the yellow background on my UITableView in IBuilder, My cells (except first row) have white background with code: UIView* backgroundView = [ [ [ UIView alloc ] initWithFrame:CGRectZero ] autorelease ];
backgroundView.backgroundColor = [UIColor colorWithRed: 0.96078431372549 green: 0.96078431372549 blue: 0.96078431372549 alpha: 1.0];
cell.backgroundView = backgroundView;
for ( UIView* view in cell.contentView.subviews )
{
view.backgroundColor = [ UIColor clearColor ];
}
alt text http://rabbitrun.karatefors.org/img1.png
The example yellow background, I only want to be showed at the top. As u see img example below. The thing is I don开发者_JAVA技巧t want to have yellow background under the last datarow, I want to contain same white color I have on the cells.
alt text http://rabbitrun.karatefors.org/img2.png
This should be white as the cells. Not yellow.
alt text http://rabbitrun.karatefors.org/img3.png
Thank u for your time. Regards
Found soulution. Just simple added a view top of the tableview.
UIView *topview = [[[UIView alloc] initWithFrame:CGRectMake(0,-480,320,480)] autorelease];
topview.backgroundColor = [UIColor colorWithRed:71.0/255.0 green:71.0/255.0 blue:71.0/255.0 alpha:1];
[self.tableView addSubview:topview];
If you want to achieve this you have to 'pad' the bottom of the table view with empty cells, and color those white. You'll still run into the same problem when bouncing at the bottom, tho'. The issue is that the cells in yellow don't exist, so they use the background-color of the table view.
Also, that yellow and that green really don't go together.
精彩评论