UItableview animation crash occuring while insert and delete - iphone

Terminating app due to uncaught exception NSInternalInconsistencyException,
Reason: Cell animation stop fraction must be greater than start fraction
while using
[self.tableView insertRowsAtIndexPaths:indexPathsToInsert withRowAnimation:insertAnimation];
[self.tableView deleteRowsAtIndexPaths:indexPathsToDelete withRowAnimation:deleteAnimation];

Its bug on iOS7.x The solution was to remove the below delegates,
tableView:viewForFooterInSection:
tableView:heightForFooterInSection:
and replace them with the below line of code in viewDidLoad.
tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];

Related

UITableViewCell's reuse identifier not recognized only when launching from RESideMenu

Here is the link to RESideMenu, what I'm using in my project
To put it simply, when I make my UITableView the root viewcontroller and launch it, it works just fine. All my custom UITableViewCells are there and look great. The issue is, whenever I try and launch the UITableView from the RESideMenu. When I do, I get this error:
2013-07-06 11:49:07.844 halocustoms[4438:c07] *** Assertion failure in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:],
/SourceCache/UIKit_Sim/UIKit-2380.17/UITableView.m:4460 2013-07-06 11:49:07.845 projectcf32[4438:c07]
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier CustomCell -
must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
I have checked my reuse identifier on my Storyboard about a hundred times, and it must work because when the app launches initially everything is fine. It's just when selecting the UITableViewController from the RESideMenu.
Note, this is how RESideMenu displays the viewcontroller:
RESideMenuItem *homeItem = [[RESideMenuItem alloc] initWithTitle:#"Quick Games" action:^(RESideMenu *menu, RESideMenuItem *item) {
[menu hide];
MyTableView *viewController = [[MyTableView alloc] init];
viewController.title = item.title;
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
[menu setRootViewController:navigationController];
}];
Thanks a lot!
MyTableView *viewController = [[MyTableView alloc] init];
should be:
MyTableView *viewController = (MyTableView *)[self.storyboard instantiateViewControllerWithIdentifier: #"yourIdentifier"];

Present UIPopoverviewcontroller

I am working on a app, which uses UIPopoverController, I am getting a problem in presenting that popover, I have a UIView which is added on self.view, and a tableview added on that view, that table view has a custom cell, which includes a UITextField, on didBeganEditing method I need popover to open.
Here is the code:
table = [[UITableView alloc]initWithFrame:CGRectMake(textField.frame.origin.x,textField.frame.origin.y,200,100) style:UITableViewStylePlain];
table.tag=3;
[table setDataSource:self];
[table setDelegate:self];
[table reloadData];
UITableViewController *tableViewController= [[UITableViewController alloc] initWithStyle:UITableViewStyleGrouped];
tableViewController.tableView = table;
popOver= [[UIPopoverController alloc]
initWithContentViewController:tableViewController];
[popOver presentPopoverFromRect:popRect inView:cell permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
I will getting following exception
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIPopoverController presentPopoverFromRect:inView:permittedArrowDirections:animated:]: Popovers cannot be presented from a view which does not have a window.'
here you present popoverview in the cell and give the Rect to popover of UITableViewController and so you get this error.. here it have not view hierarchy so its not get window and crashed here just follow the view hierarchy.

i can't navigate to the other view in (didSelectedRowAtIndexPath)

When i click on row to navigate to the other view it give me crash
"Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<detailInfo 0x6b503d0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key lblText.'
*** First throw call stack:
"
This is my code :
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
_vcontroler = [ urls objectAtIndex:indexPath.row];
if (!self.detailViewController)
{
self.detailViewController = [[[detailInfo alloc] initWithNibName:#"detailInfo" bundle:nil] autorelease];
}
detailViewController.vcontroler =_vcontroler;
[self.navigationController pushViewController:self.detailViewController animated:YES];
[detailViewController release];
}
The problem is that you removed an graphical object from view's frame without removing outlet connection. Select your view controller's .xib, then select File's Owner (left click on it) and remove outlet connection for lblText object. Build & run. It should be fine.

Terminating app due to uncaught exception, while loading a view

I am getting this error, while I am trying to load another view
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-
[__NSCFType new1:]: unrecognized selector sent to instance 0x5c27950'
Here new1 is a button, which when pressed loads a view.
And here is the code inside the new1
-(IBAction) new1:(id) sender
{
viewController = [[iTViewController alloc] initWithNibName:#"iTViewController" bundle:[NSBundle mainBundle]];
[self.view addSubview:viewController.view];
}
Note: When I launch the App from fresh and press the new1 button, it works flawlessly, but when I press other button which loads other view and when I return back to this view and press new1, then it crashes
The error * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '- [__NSCFType new1:]: unrecognized selector sent to instance 0x5c27950' may not be coming from inside the - (IBAction)new1:(id)sender method. What that error is saying is that you are trying to call a non-existent method on whatever object is at the address 0x5c27950. Here are a few possible solutions:
Set NSZombieEnabled, malloc stack logging, and guard malloc in the debugger. Then, when your App crashes, type this in the gdb comsole:
(gdb) info malloc-history 0x5c27950
Replace 0x5c27950 with the address of the object that the stack trace says caused the crash,and it will give you a much more useful stack trace and it should highlight the exact line that is causing the problem.
Check out this article for more info on NSZombieEnabled.
This one for MallocStackLogging info
More info on guard malloc here
Also, have you tried pushing the view controller (assuming your using a navigation controller):
- (IBAction)new1:(id)sender {
iTViewController *viewController = [[iTViewController alloc] initWithNibName:#"iTViewController" bundle:nil];
[self.navigationController pushViewController:viewController animated:YES];
[viewController release];
}
Or, if you are not using a nav controller, you can present it modally:
- (IBAction)new1:(id)sender {
iTViewController *viewController = [[iTViewController alloc] initWithNibName:#"iTViewController" bundle:nil];
[self presentModalViewController:viewController animated:YES];
[viewController release];
}
Another possibility is that you are calling [self new1:someButton]; but the method is not declared in your header file like so:
#interface MyViewController: UIViewController {
........
}
- (IBAction)new1:(id)sender;
#end

Reloading tableView when subclassed causing crash

Hey guys! I have some problems reloading my tableView.
I have subclasses my tableView, with a class called RadioTable. I have also subclasses my TableViewCells, but thats not important here.
I need to point out that i'm pretty new, and built my subclass from some tutorials and stuff.
First of all, here is the error message i'm getting when i try to reload my data.
I am reloading it with [self.tableView reloadData].
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "MainView" nib but didn't get a UITableView.'
Okay, so the problem is pretty clear. The view(my nib-file) does not have any tableView's connected to the Files Owner. And thats what i tried to solve. I tried to add a IBOutlet in my subclass, and setting the tableView-property there.
(My tableView-subclass is inherited from UITableView, just so thats clear)
Here is my init-code:
- (id)initWithStyle:(UITableViewStyle)style {
if ((self = [super initWithStyle:style])){
RadioTable *aTableView = [[RadioTable alloc] initWithFrame:self.tableView.frame style:style];
[aTableView setDelegate:self];
[aTableView setDataSource:self];
[aTableView setSwipeDelegate:self];
[aTableView setRowHeight:54];
[self setTableView:aTableView];
[self.tableView setScrollEnabled:NO];
[self.tableView setRowHeight:80];
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine];
[self.tableView setSeparatorColor:[UIColor lightGrayColor]];
[aTableView release];
}
return self;
}
The tableView works fine when i launch the app, it works perfect. But the problem occours when i try to reload it.
I'm not sure if this will solve your problem, but don't create your view controller's view in its init method. Instead, override loadView and create the table view in that method. And assign the table not only to the tableView property but also to the view controller's view property.
See the documentation for loadView and viewDidLoad for more info.