Auto-Layout Strangeness
Auto-Layout Strangeness
- Subject: Auto-Layout Strangeness
- From: Dave <email@hidden>
- Date: Wed, 30 Jul 2014 18:18:35 +0100
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