agapitocandemor
agapitocandemor

Reputation: 744

Group Cells in TableView

I know it's an easy issue, but I'm not able to group my cells in my tableview. I've changed the option to "Grouped" and it doesn't work.

Where can be the problem?

It's linked to File's Owner, has property, has IBOutlet, and it appears a normal TableView.

Thanks in advance.

Upvotes: 0

Views: 824

Answers (1)

Nikunj Jadav
Nikunj Jadav

Reputation: 3402

First of all you take navigation based application and open RootViewController.xib and go to property and select style group under TableView attribute and after that RootViewController.m file and run your app

// Customize the number of sections in the table view.
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 5;
}


// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 10;
}

-(void)setListTableView
{
    mytableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 59, 319, 358) style:UITableViewStyleGrouped]; 
    mytableView.separatorStyle = UITableViewCellSeparatorStyleSingleLineEtched;
    mytableView.backgroundColor = [UIColor clearColor];
    mytableView.opaque = NO;
    mytableView.delegate = self;
    mytableView.dataSource = self;
    mytableView.scrollEnabled = YES;
    mytableView.scrollsToTop = YES;
    [self.view addSubview:mytableView];
}

Upvotes: 1

Related Questions