我是Xcode的初学者,我遇到了问题。 当我在iOS模拟器中启动我的应用程序时,应用程序启动然后失败。 它告诉我,我有一个不完整的实现。它说没有找到“页面”的方法定义。
AppDelegate.h
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
@class ViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) ViewController *viewController;
@property(nonatomic, retain) MKMapView *mapView;
-(IBAction)page:(id)sender;
@end
ViewController.h
#import <UIKit/UIKit.h>
#import "MapKit/MapKit.h"
@interface ViewController : UIViewController {
IBOutlet MKMapView *mapView;
IBOutlet UISegmentedControl *maptype;
}
- (IBAction)locate:(id)sender;
- (IBAction)page:(id)sender;
@end
AppDelegate.m
#import "AppDelegate.h"
#import "ViewController.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
有人可以帮忙吗? 非常感谢!
答案 0 :(得分:1)
检查您是否错过了在ViewController.m file
中定义方法的方法。
-(IBAction)page:(id)sender
{
// your code here
}