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 7824251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:32:18+00:00 2026-06-02T08:32:18+00:00

I have my main window’s content view set like this: newContentView = [[CutoutView alloc]initWithFrame:window.frame];

  • 0

I have my main window’s content view set like this:

 newContentView = [[CutoutView alloc]initWithFrame:window.frame];
     [window setContentView:newContentView];
     [newContentView release];

Where CutoutView is the name of my subclass. Now I want to add a subview to it so I did the following,

filterView = [[FilterView alloc]initWithFrame:NSMakeRect(100, 100, 500, 500)]; 
    [newContentView addSubview:filterView];
    [filterView release];

that all works fine except now I want to call methods from my filterView subclass and I want to get it like this but it wont work.

FilterView *filter = [[NSApp delegate] contentView]; 

I read in the docs that by using contentView it only “returns the highest accessible NSView object in the window hierarchy” So I tried adding the following to the addSubview

[newContentView addSubview:filterView positioned:NSWindowAbove relativeTo:nil];

but that didnt work either any ideas as to what I need to do? Thanks!

  • 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-06-02T08:32:20+00:00Added an answer on June 2, 2026 at 8:32 am

    The content view is really your CutoutView class so you should be using:

    FilterView *filterView = [[[[[NSApp delegate] window] contentView] subviews] objectAtIndex:0];
    

    But two cleaner ways are:

    1) Use IBOutlets to keep track of your views and assign them via IB.
    2) Use tags:

    filterView.tag = 101;
    

    then use:

    FilterView* filterView = [[[NSApp delegate] contentView] viewWithTag:101];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a window(say main window) with a frame which has a page in
I have an Air application with a main window. I would like to have
I have a Cocoa application built using Garbage Collection with a main window. This
I have main window from type QMainWindow , then I set some widget and
I want to have main window split in three parts like the one on
I have my main window and I'd like to attach a sheet to it:
In my case I have a main window and a login view. When the
I have main window and in this window I have QListWidget. I want this
I have my main program window, and I would like to make a foldable
I have a main window that has a TEdit and a TButton that I

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.