0

I came across the project: https://github.com/monoqlo/ExpandingMenu which adds a button to a view. when the button is added a menu appears. You can find details behind the link.

The problem is that this project doesn't support autolayout and all frames are hard coded. So it doesn't support device orientation changes.

Currently I'm trying to rebuild it with autolayout. How would you do it?

  • Start with a xib?
  • Doing everything hard coded?

Do you know some code that could be reused?

enter image description here enter image description here

netshark1000
  • 7,245
  • 9
  • 59
  • 116
  • 1
    Unless you have specific requirements or limitations, the question is completely opinion based. Do it any way you are comfortable with, either is fine. – A-Live Feb 15 '16 at 16:15
  • Agree with @A-Live. Actually, the main problem should be about animating constraints. Link, http://stackoverflow.com/questions/12622424/how-do-i-animate-constraint-changes – razor28 Mar 01 '16 at 03:18

1 Answers1

0

Maybe you can try these:
First: check out the code of ExpandingMenu, I know it hard code, that is to say, it use the frame of its superview or [UIScreen mainScreen]'s frame. Make clear when it set its subviews frame.

Second: first may have 2 options
one is setting its subviews frame when it init or added in view: In this case , you have to rewrite it or else, in a word , you can not use it to support device orientation.
one is setting its subviews frame when it calls layoutSubviews: In this case ,it is able to support device orientation.

That is to say: if it does not support device orientation, you can fix it by rewrite it to make it setting in layoutSubviews.

childrenOurFuture
  • 1,889
  • 2
  • 14
  • 23