(This is about programatically swapping the style of existing tableview and not about setting table view style programatically)
I have a situation where I used a grouped table view in a view this table is editable and whenever it goes to editable view it gets displaced so what I thought was to change its style to plain whenever it goes to editing mode.
Is this possible? (Thanks in advance.)
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *MyIdentifier = @"MyIdentifier"; MyIdentifier = [NSString stringWithFormat:@"Cell %d",indexPath.row]; // MyIdentifier =@"tblCellView"; NSString *offendersImagePath = [self applicationDocumentsDirectory]; //NSLog(@"%@", dbPath); offendersImagePath=[offendersImagePath stringByAppendingPathComponent:@"Images"]; CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier]; if(cell == nil) { [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil]; cell = aCustomCell; aCustomCell=nil; }
You cannot change the tableView style once set. So the only way is set the style during initialisation.
A plain-style table view is an unbroken list; a grouped table view has visually distinct sections.
There are two main base ways to populate a tableview. The more popular is through Interface Building, using a prototype cell UI object. The other is strictly through code when you don't need a prototype cell from Interface Builder.
No this is not possible See this is wriiten in apple documentation:-
You set the table style when you initialize the table view (see initWithFrame:style:). You cannot modify the style thereafter.
So you can not modify it afterwards...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With