• 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: Auto-Layout Strangeness
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Auto-Layout Strangeness


  • Subject: Re: Auto-Layout Strangeness
  • From: Dave <email@hidden>
  • Date: Thu, 31 Jul 2014 12:35:49 +0100

Hi,

But why would it work ok with auto layout on? And also, why is only the first subview affected?

If someone is messing around with CALayer or whatever, then I don’t think it’s in my App, but in Cocoa-Touch and out of my control.

To recap:

If auto layout is on, the first subview of a View loaded manually from a .xib file is not drawn correctly. initWithCoder gets called and the frame and bounds look ok. But after that nothing further UIView related happens to that View. However, views inside this view all work fine.

Doesn’t work:

View in LTWItemView.xib file

First subview “ LTWItemView.xib”	 “DrawFrame” View		<— drawRect etc. not being called
	View 1 of “DrawFrame” - UILabel “DrawFrame”   		<— Works fine.
	View 2 of “DrawFrame” - UIButton “DrawFrame”  		<— Works fine.
	View 3 of “DrawFrame”  - Another DrawFrame View.	<— works fine.


If I create a dummy subview and make it the first and only subview of the View loaded from the .xib file, all works as expected.

Works:

First subview “ LTWItemView.xib”  Dummy UIView
	View 1 of Dummty - “DrawFrame” View					<— Works fine.
		View 1 of “DrawFrame” - UILabel “DrawFrame”   		<— Works fine.
		View 2 of “DrawFrame” - UIButton “DrawFrame”  		<— Works fine.
		View 3 of “DrawFrame”  - Another DrawFrame View.	<— works fine.

Thanks a lot
Dave

On 31 Jul 2014, at 12:12, Uli Kusterer <email@hidden> wrote:

> On 30 Jul 2014, at 19:18, Dave <email@hidden> wrote:
>> 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.
>
> Stab in the dark: Is someone mucking with the layer behind the view? On Mac I'd say someone is calling setContent: or setDelegate: on the CALayer, but I don't think CGLayer on iOS has that.
>
> Cheers,
> -- Uli Kusterer
> "The Witnesses of TeachText are everywhere..."
> http://www.zathras.de
>


_______________________________________________

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


References: 
 >Auto-Layout Strangeness (From: Dave <email@hidden>)
 >Re: Auto-Layout Strangeness (From: Uli Kusterer <email@hidden>)

  • Prev by Date: Re: Auto-Layout Strangeness
  • Next by Date: Re: ARC and NSObjectController bindings through file's owner
  • Previous by thread: Re: Auto-Layout Strangeness
  • Next by thread: Auto-Layout Strangeness
  • Index(es):
    • Date
    • Thread