相关疑难解决方法(0)

无法识别的选择器发送到实例

我收到以下错误消息,我无法理解为什么它发生,因为我没有使用任何UIImageView.有时我得到同样的错误,但它是一个CALayer?!?

值得一提的是,我有2个nib和2个控制器以及这个代码所在的基本控制器.

编辑:

这是我项目的结构

MainViewController及其笔尖 - nib中的HomeViewController

MainViewController-Landscape及其笔尖 - HomeViewController-Landscape in nib

HomeViewControllerBase - no nib - 存在所有出口和项目配置代码的基类. - 以下两个子课程都使用奥特莱斯. - 奥特莱斯与每个主要笔尖中的控件相关联.

HomeViewController - 从HomeViewControllerBase继承

HomeViewController-Landscape - 从HomeViewControllerBase继承

所以发生的事情是,子类正在尝试释放其基类(其中包含所有出口).我这样设计它是为了避免在不同的方向视图控制器中重复代码.

@implementation MainViewController
- (void)orientationChanged:(NSNotification *)notification
{
    UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;

    if (UIDeviceOrientationIsLandscape(deviceOrientation) && !isShowingLandscapeView)
    {
        [self presentModalViewController:self.landscapeViewController
                                animated:YES];

        isShowingLandscapeView = YES;
    }
    else if (UIDeviceOrientationIsPortrait(deviceOrientation) && isShowingLandscapeView)
    {
        [self dismissModalViewControllerAnimated:YES];
        isShowingLandscapeView = NO;
    }
}

- (id)init
{
    self = [super initWithNibName:@"MainViewController" bundle:nil];

    if (self)
    {
        isShowingLandscapeView = NO;
        self.landscapeViewController …
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

cocoa-touch ×1

iphone ×1