Wednesday, 16 December 2015

How To Set Margig Header TableVIew Ios/Iphone

UITableView has a delegate method named "viewForHeaderInSection"

. If you remove the padding an then in the delegate method
  add a padding and return the section header view.

- (UIView *)tableView:(UITableView *)

 tableView viewForHeaderInSection:(NSInteger)section{
    UIView *view = [[UIView alloc]

 initWithFrame:CGRectMake(0, 0, CGRectGetWidth(tableView.frame), 30)];
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(15, 5, 200, 25)];

    // 15 pixel padding will come from CGRectMake(15, 5, 200, 25).
    label.text = @"2013";
    [view addSubview: label];
    return view;
}