Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3212674
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T14:51:45+00:00 2026-05-17T14:51:45+00:00

I have a couple of custom NSBox subclasses called OuterBox and InnerBox. I’ve set

  • 0

I have a couple of custom NSBox subclasses called OuterBox and InnerBox. I’ve set up my view in a XIB and arranged the hierarchy like this:

OuterBox : NSBox
    NSButton
    NSBox
    InnerBox : NSBox
    ...and some other views

The idea is that when the NSButton gets pressed, in an IBAction method, I want to get the superview of the button and then, from that, get the InnerBox that is in the same OuterBox as the button.

To do this, I loop through the OuterBox’s subviews and check their type:

for (NSObject *subview in [outerBox subviews]) {
    // this never evaluates to true...
    if ([subview isKindOfClass:[InnerBox class]]) {
        // ...
    }
}

The problem is that my if statement never hits. subview shows up in the debugger as an NSView. According to the documentation, isKindOfClass:

returns YES if the receiver is an instance of aClass or an instance of any class that inherits from aClass, otherwise NO.

I understand why it’s returning NO: because InnerBox is a type of NSView but not vice versa. But I don’t know why subview is a UIView when it should be an InnerBox.

I have imported InnerBox.h and made sure that the InnerBox really is an InnerBox in the XIB. I don’t know what could be causing its type to get changed, or be reported incorrectly…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T14:51:46+00:00Added an answer on May 17, 2026 at 2:51 pm

    As far as I can tell, isKindOfClass: should return YES when it encounters your InnerBox. Perhaps the views aren’t nested the way you intended. Two things to check:

    1. Is the superview of the NSButton truly
      the OuterBox? (You could NSLog the superview of the sender in your button’s action method.)
    2. Is the InnerBox truly a subview of the
      OuterBox? (Perhaps set up an IBOutlet to the InnerBox and NSLog its superview.)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a couple duplicate custom crystal reports controls in my Toolbox in VS2005
So i have a couple of custom Http Handlers for different file types. I
We are using TFS build and we have a couple of custom steps within
I'm using Heroku, and have added a couple custom domains for my app, i.e.
I have created a UserControl, and added a couple of custom routed events. The
I'll have couple of python functions I must interface with from the assembly code.
I have a couple of questions regarding VBScript and ASP Classic: What is the
I have a couple of files containing a value in each line. EDIT :
We have a couple of mirrored SQL Server databases. My first problem - the
I have a couple old services that I want to completely uninstall. How can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.