So I can’t figure out why this extremely simple UITableView section is drawing incorrectly, and secondly when I attempt to scroll this sucker off screen it throws random errors, sometimes bad_access and other such green highlighted errors.
This is a picture of what exactly is happening on the device, and below is the code I am using first in the appDelegate to create the tableview cell’s themselves. Thanks
In the appDelegate
SignUp *signup = [[SignUp alloc] initWithNibName:@"SignUp" bundle:nil];
signup.view.frame = self.window.frame;
[self.window addSubview:signup.view];
[self.window makeKeyAndVisible];
To Create the TableView
static NSString *CellIdentifier = @"EditableCell";
EditableCell *editableCell = (EditableCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (editableCell == nil) {
editableCell = [[EditableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
UITextField *cellTextField = [editableCell textFieldCell];
cellTextField.keyboardType = UIKeyboardTypeDefault;
cellTextField.delegate = self;
return editableCell;
The Error:
You are creating your view controller, but never holding onto it with anything. As soon as your didFinishLaunchingWithOptions method exits, you’ll lose your view controller and run into memory problems. Holding onto a view controllers view does not hold onto a view controller. Instead of adding the view directly to the window use:
This will both take ownership of the view and should set it’s frame so you don’t have to do so manually. You’re currently setting the frame to the same frame of the window which is shoving it up under the status bar.