Xcode 帮助 - 未找到类“secondview"+ 方法定义的错误实现“-switchview:" [英] Help with Xcode - Incorrect implementation of class 'secondview' + method definition for '-switchview:' not found

查看:38
本文介绍了Xcode 帮助 - 未找到类“secondview"+ 方法定义的错误实现“-switchview:"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Xcode 中创建一个应用程序,当手机从一个方向旋转到另一个方向时,该应用程序将切换到新视图.

I am trying to create an application in Xcode that will switch to a new view when the phone is rotated from one orientation to another.

这是switchviewcontroller.h"文件代码:

Here is the "switchviewcontroller.h" file code:

#import <UIKit/UIKit.h>

@interface SwitchViewController : UIViewController {

}

-(IBAction)switchview:(id)sender;

@end
-----------------------------------------------------------------

And here is the "switchviewcontroller.m" file code:

----------------------------------------
#import "SwitchViewController.h"
#import "secondview.h"

@implementation SwitchViewController

// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return YES;
}

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
    if((fromInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) ||
       (fromInterfaceOrientation == UIInterfaceOrientationLandscapeRight))
    {    
        [[secondview alloc] initWithNibName:@"secondview" bundle:[NSBundle mainBundle]];
    }

}

<小时>

我收到了问题中显示的 2 个警告,但它也不起作用.


I get the 2 warnings showed in the question, and it also doesn't work.

推荐答案

好吧,未找到的方法定义准确地说..... 在您发布的代码中没有 switchview 方法.不正确的实现错误消息意味着 secondview 类不符合 uiview.

well the method definition not found is saying exact that ..... in the code you posted there is no switchview method. The incorrect implementation error message implies that the secondview class doesn't conform to a uiview.

这篇关于Xcode 帮助 - 未找到类“secondview"+ 方法定义的错误实现“-switchview:"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆