Auto-Layout Strangeness
Auto-Layout Strangeness
- Subject: Auto-Layout Strangeness
- From: Dave <email@hidden>
- Date: Wed, 30 Jul 2014 19:56:42 +0100
Hi Again,
I tried a few things to fix this, but the only thing that makes drawRect etc. trigger on the First Subview of a View Loaded manually from a NIB with Auto Layout disabled, is to add a Dummy View as the fist subview and then put all the other views inside this one. When I do this, the Background Color gets set and drawRect is called. The Dummy view has the same Frame as the View loaded from the NIB which is the same as the DrawFrameRect view.
Weird! I’d rather not have to add Dummy Views everywhere, but if it’s the only way to to fix the problem, it’s a lot easier than the alternatives.
Any thoughts?
Cheers
Dave
-----------------------------------------------------
XCode 5, Mac OS 10.9.4, iOS 7.
Hi,
I'm working on a project that uses a lot of view “cells” that go into Scroll and Table Views. Each “cell” View is in separate .xib file and is loaded something like this:
+(instancetype) newViewOfKind:(NSString*) theViewKind withItemInfo:(LTWItemInfo*) theItemInfo
{
NSString* myClassName;
LTWItemView* myNewCell;
myClassName = NSStringFromClass([self class]);
myNewCell = [[super class] newViewOfKind:theViewKind withItemInfo:theItemInfo andNIBBaseName:myClassName];
if (myNewCell.pItemActivityIndicator != nil)
myNewCell.pItemActivityIndicator.hidesWhenStopped = YES;
myNewCell.pItemDownloadImageLoadedFlag = NO;
myNewCell.pItemDownloadImage = nil;
[myNewCell setItemInfo:theItemInfo];
return myNewCell;
}
This works well and is being used in lots of places in the App.
This project was originated before Auto-Layout was around and it is off in all the cell .xib files.
The .xib file for each of these views has a “standard” layout that looks like this:
LTWItemView.xib — Auto-Layout off.
LTWItemView
“FrameRect” - View of Class “LTWDrawFrameView” Inside LTWItemView above (this is a normal view, but drawRect overridden to draw a frame around the view).
Inside the “FrameRect” view, other views UILabels, UIImageView’s, UIButton’s, etc.
The problem is that the drawRect method in “FrameRect” does not get called and it’s background colour doesn’t get set either. When I first created this view, I had Auto-Layout enabled and in this case the background colour is set ok and the drawRect is called.
The problem is that if I enabled Auto-Layout, it causes problems elsewhere and it’s too big a job to convert the project to use it.
Any ideas on how to solve this would be greatly appreciated.
Thanks a lot
Dave
_______________________________________________
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