Re: addsubview
Re: addsubview
- Subject: Re: addsubview
- From: Peter Ammon <email@hidden>
- Date: Mon, 23 Apr 2012 18:30:47 -0700
Hi koko,
This could be anything from "the view is added to the wrong subview" to "the view has a frame that moves it outside of its' parents bounds" to "the view is visible but does not draw anything."
Two powerful tools that will help you with debugging:
- Run with NSShowAllViews set to YES
- Use the _subtreeDescription method to get a list of all your views and where they are.
A web search will show you how to do either of those if you're not sure.
Hope that helps.
On Apr 20, 2012, at 9:49 AM, koko <email@hidden> wrote:
> I have searched high and low and can find no reason for a subview to not display. Is this a trivial problem not worthy of list comment or is it truly a difficult problem that cannot be dealt with as easily as more mundane topics found here?
>
> Can you hear my cry for help ... this makes no sense ...
>
> Oh well, I guess I'll have to rewind and try another approach.
>
> Ah, ain't Cocoa a great, modern (85?) environment.
>
> -koko
>
>
>
>
>
>
>
> On Apr 20, 2012, at 9:23 AM, koko wrote:
>
>> Here is the code that creates and adds the subview ....The method -makeAndWrapViews is in the custom class of the NSTabViewItem view.
>>
>> I do get -viewDidMoveToSuperview when addSubview is called.
>>
>> When the tab is clicked I do get viewdidMoveToWindow
>>
>> But I never see thev iew!
>>
>> - (void)makeAndWrapViews
>> {
>> NSRect frame = [self frame];
>> frame.size.width = 288;
>> frame.size.height = 259;
>>
>> m_text = [[NSPDText alloc] initWithFrame:frame];
>>
>> BOOL text = [NSBundle loadNibNamed:@"NSPDText" owner:m_text];
>>
>> if (text)
>> {
>> [self addSubview:m_text];
>> }
>> }
>>
>>
>>
>>
>>
>> On Apr 20, 2012, at 7:56 AM, koko wrote:
>>
>>> Good questions.
>>>
>>> As an experiment, in the same method in which I create and add the subview which is not displaying I create an NSButton using the same frame as for the subview. I add the NSButton and it displays.
>>>
>>> So, I am sure the NSTabviewItem view is correct.
>>>
>>> As to the subview, I added a delegate method for when the tab is clicked. Breaking there and dumping the subviews I see my subview in the view hierarchy.
>>>
>>> This seems such a trivial task that I am quite puzzled.
>>>
>>> -koko
>>>
>>>
>>> On Apr 19, 2012, at 9:27 PM, Keary Suska wrote:
>>>
>>>> On Apr 19, 2012, at 5:34 PM, koko wrote:
>>>>
>>>>> I get the view for an NSTabViewItem.
>>>>>
>>>>> To this view I add a subview.
>>>>
>>>> How do you (in code) identify the correct NSTabViewItem, retrieve the view and add the subview? What is the frame of the subview?
>>>>
>>>>> In the debugger displaying the subviews of view I see the subview.
>>>>
>>>> How do you know it is the correct/same subview?
>>>>
>>>>> When the NSTabViewItem displays the subview is not being shown. The view does display.
>>>>>
>>>>> The subview is not set hidden in IB.
>>>>>
>>>>> Why would I not see the subview?
>>>>
>>>>
>>>>
>>>> Keary Suska
>>>> Esoteritech, Inc.
>>>> "Demystifying technology for your home or business"
>>>>
>>>>
>>>
>>>
>>> _______________________________________________
>>>
>>> Cocoa-dev mailing list (email@hidden)
>>>
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>>
>>
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden