来自AppDelegate的警告

时间:2011-08-07 18:07:15

标签: iphone objective-c video geolocation subviews

当我呼叫其他视图控制器时,我收到以下警告..

  

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

当按下next按钮时,应用程序在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 我希望其中一个子视图是一个视频播放器 - 离线 - 另一个是一个找到用户位置的地图

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

1 个答案:

答案 0 :(得分:0)

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