Hi,
I am trying to create a grid view by using a UITableView (my older questions have pointed me in this direction) and am currently setting up the views for the individual items. Having created a custom UITableViewCell that displays 3 items per row, I have decided to pull these items into a subclass of UIView called ItemView.
This ItemView will then be added as a subview to the custom UITableViewCell to display the grid. Anyway, I have managed to create the view and can get it to display a UILabel fine, however I am having trouble in changing ItemView to be transparent apart from the UIViews (Labels, buttons, images etc) within it. Here is my code for the UIView:
#import <UIKit/UIKit.h>
@interface ItemView : UIView {
}
@end
//
#import "ItemView.h"
@implementation ItemView
- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
}
return self;
}
- (void)drawRect:(CGRect)rect {
[self setBackgroundColor:[UIColor lightGrayColor]];
}
- (void)dealloc {
[super dealloc];
}
@end
Where should I set the background color for it to work properly?
Cheers