• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to find the name of the tab view item if you have one of its sub-views(sub-sub-views)?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to find the name of the tab view item if you have one of its sub-views(sub-sub-views)?


  • Subject: Re: How to find the name of the tab view item if you have one of its sub-views(sub-sub-views)?
  • From: Mike Abdullah <email@hidden>
  • Date: Mon, 13 Mar 2006 23:54:47 +0000

Ok well, in which case, you just have to search through each of your tab views before homing in on the tab items in the right one. How are you keeping a reference to your tab views? Are they in an array, or do you just have IBoutlets pointing at them?

Mike.

On 13 Mar 2006, at 23:20, Andrei Tchijov wrote:

Sorry, forget to mention that I have more then one tab view (and I need to "find" the right one as well).


On Mar 13, 2006, at 5:59 PM, Mike Abdullah wrote:

OK, how about something like:

NSEnumerator *tabItemsEnumerator = [[MyTabView tabViewItems] objectEnumerator];
NSTabViewItem *tabItem;


// Run through each tab view and see if the view we have been given is a descendant
while (tabItem = [tabItemsEnumerator nextObject])
{
if ([viewToTest isDescendantOf: [tabItem view]])
return tabItem;
}


Hope that helps,
Mike.

On 13 Mar 2006, at 22:46, Andrei Tchijov wrote:

Yes. Typically I am getting reference to "particular view" as a sender parameter to an action. What exactly action will do, depends on on which "tab" this sender located.

On Mar 13, 2006, at 5:40 PM, Mike Abdullah wrote:

To clarify, are you saying that your app knows of a particular view, and you would to find out which tab of your tab view it is in?

Mike.

On 13 Mar 2006, at 20:36, Andrei Tchijov wrote:

In my application I need to get reference to NSTabViewItem object starting with its sub-sub-view. Firstly, I tried to traverse views hierarchy via "[ view superview ]", but soon discovered that NSTavViewItem object could not be found this way. After some tinkering I come up with this :

			...
			id superview = [ startView superview ];
			id subview = startView;

while (( superview != nil ) && ( ! [ superview isKindOfClass: [ NSTabView class ]] )) {
subview = superview;
superview = [ superview superview ];
}
NSArray* tabViewItems = [ superview tabViewItems ];
for( int i = 0; i < [ tabViewItems count ]; i++ ) {
if( [[ tabViewItems objectAtIndex: i ] view ] == subview ) {
subview = [ tabViewItems objectAtIndex: i ];
break;
}
}
...


It works, but does not look right. I can not believe that there is no better(simplier) way of doing it.

Any comments, suggestions will be highly appreciated	

Andrei Tchijov


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com


This email sent to email@hidden





_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >How to find the name of the tab view item if you have one of its sub-views(sub-sub-views)? (From: Andrei Tchijov <email@hidden>)
 >Re: How to find the name of the tab view item if you have one of its sub-views(sub-sub-views)? (From: Mike Abdullah <email@hidden>)
 >Re: How to find the name of the tab view item if you have one of its sub-views(sub-sub-views)? (From: Andrei Tchijov <email@hidden>)
 >Re: How to find the name of the tab view item if you have one of its sub-views(sub-sub-views)? (From: Mike Abdullah <email@hidden>)
 >Re: How to find the name of the tab view item if you have one of its sub-views(sub-sub-views)? (From: Andrei Tchijov <email@hidden>)

  • Prev by Date: Re: Weird printing and Core Data crash
  • Next by Date: [Moderator] Re: Registering software
  • Previous by thread: Re: How to find the name of the tab view item if you have one of its sub-views(sub-sub-views)?
  • Next by thread: Re: How to find the name of the tab view item if you have one of its sub-views(sub-sub-views)?
  • Index(es):
    • Date
    • Thread