Why should inheritance start with NSObject and then use inheritance in another class?
I wonder why I have a subclass of "FatherClass" from the UIViewController. So I want to create an inheritance of FatherClass (ChildClass: FatherClass).
I can not do this, I get an error log. All the examples I searched here and Google start with NSObject as a father.
So my question should be like that? Or am I mistaken somewhere.
Here is the error log
CoreFoundation`CFStringGetCharacters:
0x33d6c6f8: push.w {r8, r10}
thank
EDIT HERE with code
FatherClass.h
@class ChildClass;
@interface FatherClass : UIViewController <UITabBarControllerDelegate, UINavigationBarDelegate, UIPopoverControllerDelegate, MKMapViewDelegate, MKAnnotation>
{
}
@property (nonatomic, strong) ChildClass *sidebar_table_controller;
-(void) show_modal: (id) sender;
@end
FatherClass.m
#import "FatherClass.h"
#import "ChildClass.h"
@interface FatherClass ()
@end
@implementation FatherClass
@synthesize sidebar_table_controller;
-(void) show_modal: (id) sender
{
[self presentModalViewController:self.sidebar_table_controller animated:YES];
NSLog(@"Clicked ?...%@", sender);
}
@end
Now baby
ChildClass.h
@interface ChildClass : FatherClass <UINavigationControllerDelegate, UITableViewDataSource, UITableViewDelegate>
@end
ChildClass.m
#import "ChildClass.h"
@interface ChildClass ()
@end
@implementation ChildClass
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[FatherClass show_modal:indexPath];
}
@end
When I change ChildClass: UIViewController to ChildClass: My application’s father disconnected.
source
share