groups

name language licence
Find all subviews with matching resize mask Objective-C Other
Random integer between two specific values Objective-C Other
Custom Two-View Predicate Editor keypath=BOOL Template Objective-C Other
Examine View/Subview Bindings Objective-C Other
Get Class Name for Object Javascript Other

< 1 2 3 4 >



language: Objective-C
licence: Other

Find all subviews with matching resize mask

options: view full snippetsend to code collector
// Create a set of views to ignore if you 1) don't want to traverse that view's hierarchy or 2) don't want the initial
// view passed in to be added to the list.
-(NSDictionary *) findItemsMatchingResizeMask:(NSInteger)_mask inView:(NSView *)_aView ignoringViews:(NSSet *)_ignoreViews recursive:(BOOL)_shouldRecurse
{
	NSMutableDictionary *_mDict = [NSMutableDictionary dictionaryWithCapacity:10];
	
	if( ([_aView autoresizingMask] & _mask) && ![_ignoreViews containsObject:_aView] )
		[_mDict setObject:[NSNumber numberWithInteger:[_aView autoresizingMask]] forKey:[NSValue valueWithPointer:_aView]];
		
	for( NSView *subview in [_aView subviews] )
	{
		if( _shouldRecurse )
			[_mDict addEntriesFromDictionary:[self findItemsMatchingResizeMask:_mask inView:subview ignoringViews:(NSSet *)_ignoreViews recursive:_shouldRecurse]];
		else
		{
	
(Continues...)