Hi i am new for iOS and in my app i am using TableList and i want to set the tableList cell corner radius as 3.0. Here is my code. It is only applying the corner radius on left corner instead of all corners.
my code:-
- (CGFloat)tableView:(UITableView *)aTableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 75;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *simpleTableIdentifier = @"MyCell";
Cell = (MyTripsCell *)[MaintableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (Cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"MyTripsCell" owner:self options:nil];
Cell = [nib objectAtIndex:0];
}
Cell.layer.cornerRadius = 0.0;
Cell.selectionStyle = UITableViewCellSelectionStyleNone;
return Cell;
}
-(void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *) cell forRowAtIndexPath:(NSIndexPath *)indexPath{
cell.contentView.backgroundColor = [Bg colorWithHexString:@"EEEEEE"];
UIView * whiteRoundedView = [[UIView alloc]initWithFrame:CGRectMake(0, 12, MaintableView.frame.size.width, 70)];
whiteRoundedView.layer.backgroundColor = [Bg colorWithHexString:@"FDFDFD"].CGColor;
whiteRoundedView.layer.masksToBounds = YES;
whiteRoundedView.layer.cornerRadius = 3.0;
whiteRoundedView.layer.shadowOffset = CGSizeMake(-1, -1);
[cell.contentView addSubview:whiteRoundedView];
[cell.contentView sendSubviewToBack:whiteRoundedView];
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
[cell setPreservesSuperviewLayoutMargins:NO];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}