no visible interface

Discussion in 'iOS Programming' started by Kapthehat, Aug 21, 2013.

  1. Kapthehat macrumors member

    Joined:
    Jul 1, 2013
    #1
    Hello

    I am getting a "no visible interface for UIView" on the last line in my code (underlined). can anybody explain why ? thanks

    Kaps

    Code:
    
    //
    //  BIDSwitchViewController.m
    //  view Switcher
    //
    //  Created by Kapil Kapur on 21/08/2013.
    //  Copyright (c) 2013 Apress. All rights reserved.
    //
    
    #import "BIDSwitchViewController.h"
    #import "BIDYellowViewController.h"
    #import "BIDBlueViewController.h"
    
    @interface BIDSwitchViewController ()
    
    @end
    
    @implementation BIDSwitchViewController
    
    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
    {
        self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
        if (self) {
            // Custom initialization
        }
        return self;
    }
    
    - (void)viewDidLoad
    {
        [super viewDidLoad];
        // Do any additional setup after loading the view from its nib.
        self.blueViewController = [[BIDBlueViewController alloc]
                                   initWithNibName:@"BlueView" bundle: nil];
        [self.view insertSubview:self.blueViewController.view atIndex:0];
        
        
        
    }
    
    - (void)didReceiveMemoryWarning
    {
        [super didReceiveMemoryWarning];
        // Dispose of any resources that can be recreated.
        
        if (self.blueViewController.view.superview == nil)
        {
            self.blueViewController =nil;
        }
        else
        {
            self.yellowViewController=nil;
            
            
        }
    }
    
    
    -(IBAction)switchViews:(id)sender
    {
        if (self.yellowViewController.view.superview == nil)
            
        {
            if (self.yellowViewController== nil)
            {
                self.yellowViewController = [[BIDYellowViewController alloc] initWithNibName:@"YellowView" bundle:nil];
            }
            
            
            [self.blueViewController.view removeFromSuperview];
            [self.view insertSubview:self.yellowViewController.view atIndex:0];
            
            
        }
        else
        {
         if (self.blueViewController==nil)
         {
             self.blueViewController = [[BIDBlueViewController alloc] initWithNibName:@"BlueView" bundle:nil];
             
         }
            [self.yellowViewController.view removeFromSuperview];
            [U][B][self.view insertSubView:self.blueViewController.view atIndex:0];
    [/B][/U]        
            
        }
            
            
    }
    @end
    
    
     
  2. Guiyon, Aug 21, 2013
    Last edited: Aug 22, 2013

    Guiyon macrumors 6502a

    Joined:
    Mar 19, 2008
    Location:
    North Shore, MA
    #2
    insertSubView:atIndex: is not a valid UIView method. You have subtle error in that line of code. Recheck the documentation; the error should stick right out.
     
  3. Kapthehat thread starter macrumors member

    Joined:
    Jul 1, 2013
    #3
    Thanks. I re-entered the line and it worked. However when I ran it I get a message saying that the view outlet was not set. I have checked and there is a connection from the File's Owner to the view - so I am a bit confused.

    Can somebody help ? thanks

    regards

    Kaps
     
  4. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #4
    Without your Xcode project, it's rather difficult to help you find out why your connections aren't working.
     

Share This Page