Dismiss keyboard on the Textfield - Custom TableCell - ios

I have a custom cell and in the custom cell, I have a textfield where user can able to change the value. No matter, what I tried, I cannot able to dismiss the keyboard when user enters some values. It does not hit any of the delegate methods shown below.
CheckOutTableViewCell.m
#import "CheckOutTableViewCell.h"
#implementation CheckOutTableViewCell
#synthesize productName;
#synthesize productPrice;
#synthesize productOrderNumberTF;
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
-(id) init;
{
self = [super init];
if (!self) return nil;
productOrderNumberTF.delegate = (id)self;
return self;
}
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
// enter closes the keyboard
if ([string isEqualToString:#"\n"])
{
[textField resignFirstResponder];
return NO;
}
return YES;
}
- (void) textFieldDidEndEditing:(UITextField *)textField {
NSLog(#"%#", textField.text);
}
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
[textField resignFirstResponder];
return YES;
}
// dismiss keyboard when user clicks on anywhere on the UI
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[self.productOrderNumberTF resignFirstResponder];
}
CheckOutTableViewController.m
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = #"cell";
CheckOutTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil)
{
cell = [[CheckOutTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
cell.productOrderNumberTF.delegate = (id)self;
}
return cell
}
Screenshot of the ViewController

Your delegate methods are not calling because of your textfield delegate value is not assigned.
Assign the delegate value inside the awakeFromNib
- (void)awakeFromNib {
[super awakeFromNib];
productOrderNumberTF.delegate = self;
}
The nib-loading infrastructure sends an awakeFromNib message to each object recreated from a nib archive, but only after all the objects in the archive have been loaded and initialized. When an object receives an awakeFromNib message, it is guaranteed to have all its outlet and action connections already established.

Related

UITextField show keyboard on tableviewcell click

I have a simple custom table view cell that has a label and a textfield. Looks like this in the storyboard:
I would like to show the keyboard when the user clicks anywhere in the cell, including if they click the label. I was 99% sure the way to achieve this would be to call becomeFirstResponder when the cell is clicked.
Here is my simple ViewController:
#import "ViewController.h"
#interface ViewController ()
#property (weak, nonatomic) IBOutlet UITableView *tableView;
#end
#implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.tableView.dataSource = self;
self.tableView.delegate = self;
[self.tableView setEstimatedRowHeight:44.0f];
[self.tableView setRowHeight:UITableViewAutomaticDimension];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 1;
}
- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"custom"];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [self tableView:tableView cellForRowAtIndexPath:indexPath];
BOOL firstResponder = [cell becomeFirstResponder];
}
And my custom table view cell:
#import "CustomTableViewCell.h"
#implementation CustomTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (BOOL) canBecomeFirstResponder {
return YES;
}
- (BOOL) becomeFirstResponder {
return [self.textField becomeFirstResponder];
}
#end
I verified that becomeFirstResponder is called, however that is returning false. What am I missing?
Think as #alex-i points out in a comment here:
This [text field not becoming first responder] can also occur when the textfield is briefly removed from the
view/window hierarchy while becoming the first responder (e.g.
reloading a UITableView or UICollectionView that holds that
textfield).
Which will happen on selection.
Rather than use didSelectRowAtIndexPath, you can add a UITapGestureRecognizer to your tableView with an action like:
- (IBAction)tap:(UITapGestureRecognizer *)sender
{
CGPoint location = [sender locationInView:self.tableView];
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:location];
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
BOOL firstResponder = [cell becomeFirstResponder];
}
And it will become first responder.
If someone needs a swift alternative: You can connect outer UIViews with outlet collection. On each UIViewController class you have once call below. So that when the outer box is touched, editfield will be activated with keyboard. You can apply this to your labels as well. (By disabling label's User Interaction)
#IBOutlet var outerBoxes:[UIView]!
override func viewDidLoad() {
super.viewDidLoad();
for outerBox in outerBoxes { outerBox.respondForEditBox() };
...
But once you have to have this code:
extension UIView {
func respondForEditBox() {
let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(UIView.focusOnEditBox));
self.addGestureRecognizer(tap);
}
func focusOnEditBox() {
for sview in self.subviews {
if sview is UITextField {
sview.becomeFirstResponder();
}
}
}
}
Inspired by #Esqarrouth's answer at
Close iOS Keyboard by touching anywhere using Swift

How to load text from UITextField and show it in UITableView every time textfield return text

I am aware this question has been asked before but the answer is not clear
The problem is that theUITableview is using data fromviewDidLoad method
where theNSMuatableArray has been allocated and initialised but contains void. But in the textfield method oftextFieldDidEndEditing,NSMutableArray do contain text from textField.
I have a single viewController and texField and tableview exist in it having dataSource set to the same viewController.
The problem is how can I pass that value toUITableView
viewController.h
#import <UIKit/UIKit.h>
#interface ViewController : UIViewController<UITableViewDataSource>
#property (weak, nonatomic) IBOutlet UITextField *TextField;
#property NSString *content;
#property (nonatomic, strong) NSMutableArray *textFieldArray;
#end
viewController.m
#import "ViewController.h"
#interface ViewController ()
#end
#implementation ViewController
-(BOOL)textFieldShouldReturn:(UITextField *) textField{
self.content = [textField text];
NSLog(#"content is %#", self.content);
[textField resignFirstResponder];
return YES;
}
-(bool)textFieldDidEndEditing:(UITextField *) textField {
[self.textFieldArray addObject:self.content];
[textField setText:#""];
NSLog(#"Array inside field did end editing is %#", self.textFieldArray);
return YES;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.textFieldArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"cell"];
cell.textLabel.text = self.textFieldArray[indexPath.row];
return cell;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.textFieldArray = [[NSMutableArray alloc]initWithObjects:#"add more task", nil];
NSLog(#"box in viewDidLoad ris %#", self.textFieldArray);
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#end
In your textFieldDidEndEditing: method after fetching the text from textfield reload the table view so that the new value get reflected. Do it this way:
[self.textFieldArray addObject:self.content];
[textField setText:#""];
// Your code is missing the following line
[tableView reloadData]; // tableView is instance of your table view
NSLog(#"Array inside field did end editing is %#", self.textFieldArray);
return YES;
Vivek's Answer is perfectly fine, except that fact you don;t need to reload table unless it's really necessary (extra processing time and all you know), so instead of reloading entire table you can add just one row, like this:
- (void) textFieldDidEndEditing:(UITextField *)textField {
[_tableDSArray addObject:textField.text];
[self.tableView insertRowsAtIndexPaths:#[[NSIndexPath indexPathForRow:tableDSArray.count-1 inSection:0]] withRowAnimation:UITableViewRowAnimationLeft];
}
-(bool)textFieldDidEndEditing:(UITextField *) textField {
[self.textFieldArray addObject:self.content];
[textField setText:#""];
[tableView reloadData]; //Reload tableview
return YES;
}
Call tableview reload in textFieldDidEndEditing delegate
-(bool)textFieldDidEndEditing:(UITextField *) textField {
[self.textFieldArray addObject:self.content];
[textField setText:#""];
[tableView setdelegate:nil];
[tableView setdatasource:nil];
[tableView setdelegate:self];
[tableView setdatasource:self];
[tableView reloadData];
NSLog(#"Updated With Entered Text:\n%#",self.textFieldArray);
return YES;
}

UISearchBar - ReturnKeyType not working for iOS 8

I am using UISearchbar in tableview controller in storyboard.
And searchbar returnKeyType is UIReturnKeySearch.
Its working fine with iOS7 but returnKeyType is not working with iOS8.
in iOS8, return key appears every time in keyboard.
I tried to set returnkeytype in viewDidLoad method of controller too.
What I need to do to set returnKeyType = UIReturnKeySearch in iOS8?
I think you can go with your hard codded logic for right now.
I will update if I will get better solution for your problem.
-(void)viewDidLoad {
[self setReturnKeyTypeSearchForView:searchBar];
}
-(void)setReturnKeyTypeSearchForView:(UIView *)view
{
for (id subView in view.subviews) {
if ([subView isKindOfClass:[UITextField class]]) {
[subView setReturnKeyType:UIReturnKeySearch];
}
else {
[self setReturnKeyTypeSearchForView:subView];
}
}
if ([view isKindOfClass:[UITextField class]]) {
[(UITextField *)view setReturnKeyType:UIReturnKeySearch];
}
}
Try making IBOutlet of your SearchBar
#property (weak, nonatomic) IBOutlet UISearchBar *searchBar;
and add the below line code to your viewDidLoad Method
// if u want Done return key and change accordingly.
_searchBar.returnKeyType = UIReturnKeyDone;
SearchViewController.h
//
#import <UIKit/UIKit.h>
#interface SearchViewController : UIViewController
<UISearchBarDelegate, UITableViewDataSource> {
NSMutableArray *tableData;
UIView *disableViewOverlay;
UITableView *theTableView;
UISearchBar *theSearchBar;
}
#property(retain) NSMutableArray *tableData;
#property(retain) UIView *disableViewOverlay;
#property (nonatomic, retain) IBOutlet UITableView *theTableView;
#property (nonatomic, retain) IBOutlet UISearchBar *theSearchBar;
- (void)searchBar:(UISearchBar *)searchBar activate:(BOOL) active;
#end
SearchViewController.m
//
#import "SearchViewController.h"
#implementation SearchViewController
#synthesize tableData;
#synthesize disableViewOverlay;
#synthesize theSearchBar;
#synthesize theTableView;
// Initialize tableData and disabledViewOverlay
- (void)viewDidLoad {
[super viewDidLoad];
self.tableData =[[NSMutableArray alloc]init];
self.disableViewOverlay = [[UIView alloc]
initWithFrame:CGRectMake(0.0f,44.0f,320.0f,416.0f)];
self.disableViewOverlay.backgroundColor=[UIColor blackColor];
self.disableViewOverlay.alpha = 0;
}
// Since this view is only for searching give the UISearchBar
// focus right away
- (void)viewDidAppear:(BOOL)animated {
[self.theSearchBar becomeFirstResponder];
[super viewDidAppear:animated];
}
#pragma mark -
#pragma mark UISearchBarDelegate Methods
- (void)searchBar:(UISearchBar *)searchBar
textDidChange:(NSString *)searchText {
// We don't want to do anything until the user clicks
// the 'Search' button.
// If you wanted to display results as the user types
// you would do that here.
}
- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar {
// searchBarTextDidBeginEditing is called whenever
// focus is given to the UISearchBar
// call our activate method so that we can do some
// additional things when the UISearchBar shows.
[self searchBar:searchBar activate:YES];
}
- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar {
// searchBarTextDidEndEditing is fired whenever the
// UISearchBar loses focus
// We don't need to do anything here.
}
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
// Clear the search text
// Deactivate the UISearchBar
searchBar.text=#"";
[self searchBar:searchBar activate:NO];
}
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
// Do the search and show the results in tableview
// Deactivate the UISearchBar
// You'll probably want to do this on another thread
// SomeService is just a dummy class representing some
// api that you are using to do the search
NSArray *results = [SomeService doSearch:searchBar.text];
[self searchBar:searchBar activate:NO];
[self.tableData removeAllObjects];
[self.tableData addObjectsFromArray:results];
[self.theTableView reloadData];
}
// We call this when we want to activate/deactivate the UISearchBar
// Depending on active (YES/NO) we disable/enable selection and
// scrolling on the UITableView
// Show/Hide the UISearchBar Cancel button
// Fade the screen In/Out with the disableViewOverlay and
// simple Animations
- (void)searchBar:(UISearchBar *)searchBar activate:(BOOL) active{
self.theTableView.allowsSelection = !active;
self.theTableView.scrollEnabled = !active;
if (!active) {
[disableViewOverlay removeFromSuperview];
[searchBar resignFirstResponder];
} else {
self.disableViewOverlay.alpha = 0;
[self.view addSubview:self.disableViewOverlay];
[UIView beginAnimations:#"FadeIn" context:nil];
[UIView setAnimationDuration:0.5];
self.disableViewOverlay.alpha = 0.6;
[UIView commitAnimations];
// probably not needed if you have a details view since you
// will go there on selection
NSIndexPath *selected = [self.theTableView
indexPathForSelectedRow];
if (selected) {
[self.theTableView deselectRowAtIndexPath:selected
animated:NO];
}
}
[searchBar setShowsCancelButton:active animated:YES];
}
#pragma mark -
#pragma mark UITableViewDataSource Methods
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section {
return [tableData count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = #"SearchResult";
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:MyIdentifier] autorelease];
}
id *data = [self.tableData objectAtIndex:indexPath.row];
cell.textLabel.text = data.name;
return cell;
}
#pragma mark -
#pragma mark Memory Management Methods
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[theTableView release], theTableView = nil;
[theSearchBar release], theSearchBar = nil;
[tableData dealloc];
[disableViewOverlay dealloc];
[super dealloc];
}
#end
Building a SearchView with UISearchBar and UITableView
this might helps you :)
I'm not sure if I understood your question correctly. You want to have "search" button instead of "return" button, right? There is a new SearchController in ios 8, give it a try:
YourTableViewController.h
#interface YourTableViewController : UITableViewController<UISearchResultsUpdating>
#end
And now the implementation:
YourTableViewController.m
- (void)viewDidLoad {
// initializing with the same controller as presenting
UISearchController *searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
searchController.searchResultsUpdater = self;
searchController.searchBar.frame = CGRectMake(searchController.searchBar.frame.origin.x, searchController.searchBar.frame.origin.y, searchController.searchBar.frame.size.width, 44.0f);
searchController.dimsBackgroundDuringPresentation = NO;
searchController.searchBar.delegate = self;
searchController.searchBar.returnKeyType = UIReturnKeySearch; //should be search by default.. you can change to whatever you want.
// adding searchBar into HeaderView
self.tableView.tableHeaderView = searchController.searchBar;
// just to be able to present results on the same controller
self.definesPresentationContext = YES;
}
You also have to implement method from UISearchResultsUpdating protocol:
- (void)updateSearchResultsForSearchController:(UISearchController *)searchController {
// you can leave it blank
}
EDIT: If it is not what you were looking for please comment, so I can update my answer accordingly
try this in viewDidLoad:
UITextField *txfSearchField = [yourSearchbar valueForKey:#"_searchField"];
if([txfSearchField conformsToProtocol:#protocol(UITextInputTraits)]) {
[txfSearchField setReturnKeyType:UIReturnKeyDefault];
}

Display TableView from TextField and passing data

I'm learning Xcode and programming for the IPad. I have a TableView and can display it using a button. I would rather display it when I click on a TextField. If I dismiss the first responder, the keyboard, how then do I display the tableView? I have not found a example that fits. Any direction would help.
It is just simple
just in UItextField delegate method create your tableview.But return No ,that will never show keyboard and write your tableview code there.
here your have to use user defined delegates.
//firstViewController
***********************
#interface ViewController ()<UITextFieldDelegate,send>
{
UITextField *textField;
}
#end
#implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
textField=[[UITextField alloc]initWithFrame:CGRectMake(20, 20, 160, 60)];
textField.delegate=self;
textField.backgroundColor=[UIColor greenColor];
[self.view addSubview:textField];
}
-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
TableViewController *table=[[TableViewController alloc]initWithNibName:#"TableViewController" bundle:nil];
table.delegate=self;
[self presentViewController:table animated:YES completion:nil];
return NO;
}
-(void)clickedValue:(NSString *)name
{
textField.text=name;
}
//secondcontroller
*********************
in.h
#protocol send <NSObject>
#required
-(void)clickedValue:(NSString *)name;
#end
#interface........
#property (nonatomic, retain) id<send> delegate;
.m
******
#interface TableViewController ()
{
NSArray *arr;
}
#end
#implementation TableViewController
- (void)viewDidLoad
{
[super viewDidLoad];
arr=[[NSArray alloc]initWithObjects:#"murali",#"mohan",nil];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return arr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.textLabel.text=[arr objectAtIndex:indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.delegate clickedValue:[arr objectAtIndex:indexPath.row]];
[self dismissViewControllerAnimated:YES completion:nil];;
}

UITableView always in plain mode though defined otherwise in the XIB

I've created a UITableView using the presets using the UITableViewController option in the New File dialog. I set the style to grouped using the Interface Builder.
However, the table always shows up in plain style.
The data source consists of two sections with two items each and a section header. It all shows up OK, but the style is wrong. Via NSLog I validated that the style is really set to plain at runtime. Am I missing something?
EDIT: Here my code. As I mentioned the NSLog calls return the expected values.
#implementation EventTableView
#synthesize tableView = _tableView;
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
return self;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
[[self navigationItem] setTitle:#"Events"];
self.clearsSelectionOnViewWillAppear = YES;
NSLog(#"Table view style: %#.", (self.tableView.style == UITableViewStylePlain ? #"Plain" : #"Grouped"));
}
- (void)viewDidUnload
{
[super viewDidUnload];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
if (_appDelegate == nil) {
_appDelegate = (MyAppDelegate *) [[UIApplication sharedApplication] delegate];
}
return _appDelegate.model.eventSections.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
Section* eventSection = [_appDelegate.model.eventSections objectAtIndex:section];
NSInteger result = [eventSection getCountAsInteger];
if (eventSection != nil && result >= 0) {
NSLog(#"Got %d rows in event section %d.", result, section);
return result;
} else {
NSLog(#"Can't get event section row count. Defaulting to 0.");
return 0;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"EventCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
cell.textLabel.text = #"Test";
return cell;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
Section* eventSection = [_appDelegate.model.eventSections objectAtIndex:section];
return eventSection.name;
}
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(#"Pressed row...");
}
#end
EDIT: To help things, I included a screenshot of the Interface Builder (style set to group).
Updated:
Find
- (id)initWithFrame:(CGRect)frame style:(UITableViewStyle)style
in your controller, set there style = UITableViewStyleGrouped; before calling to super
If you don't have any code somewhere that calls the - (id)initWithStyle:(UITableViewStyle)style method of your view with the wrong style (which I kind of expect),
you could rewrite your init method to
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:UITableViewStyleGrouped];
return self;
}
First, though, you might try to ensure that you've saved your .xib in Xcode, clean and rebuild your app, so that you're sure that your changes are what's actually running on the device/simulator.
That's really crazy. I found a kind of a work around.
I added a standard UIViewController and implemented the protocols UITableViewDelegate and UITableViewDataSource on it.
In the XIB/NIB I removed the standard UIView and added a UITableView. I connected the view's outlets datasource and delegate to the File Owner object and the File Owner's view outlet to the UITableView.
Now I am able to set the style of the table to grouped. Everything works great so far. However, I don't get what's really different to using a UITableViewController...

Resources