开发者

iPhone SDK symbol not found, defined in .mm file

开发者 https://www.devze.com 2023-02-22 11:10 出处:网络
I\'m trying to build an objective c++ class, which compiles fine until someone tries to use the class. I want opena viewControllerwith modal view Controller but the compiler gives me this warning :

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消