Iam working on GMGridView and do some customization. Given :
1. I have a gridView containing gridViewCell
2. I have button called checkBox
My Goal is to add checkBox for every gridViewCell
Below what I have so far
after running it, no checkbox is shown on each cell. I cant see the bug.. Please help if you were experiencing before
I did attach an picture so you can take a look about it
( Again : my goal is to display checkbox on each purple cell)
1. I have a gridView containing gridViewCell
2. I have button called checkBox
My Goal is to add checkBox for every gridViewCell
Below what I have so far
Code:
- (GMGridViewCell *)GMGridView: (GMGridView *)gridView cellForItemAtIndex: (NSInteger)index
{
CGSize size = [self sizeForItemsInGMGridView:gridView];
GMGridViewCell *cell = [gridView dequeueReusableCell];
if (!cell)
{
cell = [[GMGridViewCell alloc] init];
// create an UIView
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
// do some customization for my view
view.backgroundColor = [UIColor purpleColor];
view.layer.masksToBounds = NO;
view.layer.cornerRadius = 8;
view.layer.shadowColor = [UIColor grayColor].CGColor;
view.layer.shadowOffset = CGSizeMake(5, 5);
view.layer.shadowPath = [UIBezierPath bezierPathWithRect:view.bounds].CGPath;
view.layer.shadowRadius = 8;
// create a button called checkBox
UIButton *checkBox = [[UIButton alloc] initWithFrame:CGRectMake(70, 20, 150, 25)];
[checkBox setTitleColor:[UIColor purpleColor] forState:UIControlStateNormal];
[checkBox setImage:[UIImage imageNamed:@"checkbox_not_ticked"] forState: (UIControlStateNormal)];
// add checkbox to my view
[B] [view addSubView: checkBox] [/B]
cell.contentView = view;
}
after running it, no checkbox is shown on each cell. I cant see the bug.. Please help if you were experiencing before
I did attach an picture so you can take a look about it
( Again : my goal is to display checkbox on each purple cell)
Attachments
Last edited by a moderator: