iPhone SDK symbol not found, defined in .mm file
I'm trying to build an objective c++ class, which compiles fine until someone tries to use the class. I want open a viewController with modal view Controller but the compiler gives me this warning :
MainView.mm: warning: Semantic Issue: Method
'-presentModalViewController:animated:' not found (return type defaults to 'id')
.h
#import <UIKit/UIKit.h>
@interface MainView : UIView <UIApplicationDelegate> {
UIWindow *window;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
- (IBAction)showInfo;
.mm :
#import "Calendar.h"
@implementation MainView
@synthesize window , day ,year ,myDate ,eventsLabel , bg;
- (id)initWithFrame:(CGRect)frame {
if (self == [super initWithFrame:frame]) {
}
return self;
}
- (IBAction)showCal {
Calendar *controller = [[Calendar alloc] initWithNibNa开发者_运维知识库me:nil bundle:nil];
[MainView presentModalViewController:controller animated:YES];
[controller release];
}
and application crashes ! so what can I do to solve this problem ?
-presentModalViewController:animated:
is a method of the UIViewController
class.
Is self
in your code a view controller? Or is it just a view?
精彩评论