UrbanApps / UAModalPanel

An animated modal panel alternative for iOS
http://code.coneybeare.net/uamodalpanel-an-open-source-modal-panel-alter
Other
877 stars 136 forks source link

contentView is always (0,0,0,0) when constructing panel #16

Open adamgit opened 12 years ago

adamgit commented 12 years ago

Customizing the panel fails in most cases because you cannot read the size of the content area.

Workaround:

  1. after instantiating the panel (initWithFrame:), add it to the target view
  2. call [panel layoutSubviews]; to force it to calculate its TRUE sizes
  3. run the customization code

NB: this means you must not put your panel-contents-code into "initWithFrame:" - because during that method you have no way to get your sizes correct ... unless it's safe to call layoutSubviews inside the constructor?

(your example panel ignores sizes, so doesn't have this problem)