0

当我调用其他视图控制器时,我收到以下警告。

WindowMultivewAppDelegate 可能不会响应 -switchView 来查看

这是我在 Firstviewcontroller.m 中的代码

- (IBAction)swapViews:(id)sender{

WindowMultiViewAppDelegate *delegate = (WindowMultiViewAppDelegate *)[[UIApplication       sharedApplication] delegate];
SecondViewController *secondView = [[SecondViewController alloc]    initWithNibName:@"SecondViewController" bundle:nil];
[delegate switchView:self toView:secondView.view];

 }

这是我在 Firstviewcontroller.h 中的代码

#import <UIKit/UIKit.h>


@interface FirstViewController : UIViewController {



}

- (IBAction)swapViews:(id)sender;

@end

在 appdelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:     (NSDictionary *)launchOptions {    


 initWithNibName:@"FirstViewController" bundle:nil];
[self.window addSubview:navigationController.view];

locationManager = [[CLLocationManager alloc] init];
locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; // 100 m
if ([CLLocationManager locationServicesEnabled]) {

    [locationManager startUpdatingLocation];     
}



[self.window makeKeyAndVisible];

return YES;
}

在 appdelegate.h

@interface WindowMultiViewAppDelegate : NSObject <UIApplicationDelegate,     CLLocationManagerDelegate , MKMapViewDelegate> {
UIWindow *window;
UINavigationController *navigationController;

CLLocationManager *locationManager;



}


@property (nonatomic, retain) IBOutlet UIWindow *window;

@property (nonatomic, retain) IBOutlet CLLocationManager *locationManager;

@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;

@end

我在 mainWindow.xib 中放置了一个 UInavgationcontroller,它通向我命名为 FirstViewController 的 rootviewcontroller

当按下下一个按钮时,应用程序在 secondviewcontroller 中停止,该按钮内部具有该操作

- (IBAction)swapNext:(id)sender
{
WindowMultiViewAppDelegate *delegate = (WindowMultiViewAppDelegate *)[[UIApplication sharedApplication] delegate];
MediaViewController *mediaView = [[MediaViewController alloc] initWithNibName:@"MediaViewController" bundle:nil];
[delegate switchView:self toView:mediaView.view];

}

我究竟做错了什么??

谁能告诉我如何将更多子视图连接到 UINavigationController 我希望其中一个子视图成为视频播放器 - 离线 - 而另一个是找到用户位置的地图

我是初学者....谢谢大家当我知道我会帮助别人:))

4

1 回答 1

0

我没有看到您在switchView:任何地方定义了该方法,因此您收到有关此的警告也就不足为奇了。

于 2011-08-07T18:52:27.810 回答