Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive update attributes #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

m1entus
Copy link

@m1entus m1entus commented Mar 25, 2015

Haight Bar should be able to update attributes of subviews of views

@bryankeller
Copy link
Owner

Thanks for the contribution @m1entus. I'd like to discuss this a bit further and explain why, for now, I don't think this should be merged in.

During development, I considered implementing this functionality. I decided against it because in my opinion, the flexible height bar should not be responsible for updating layout attributes for its view's subviews.

The more appropriate solution is to make the views that you add to the flexible height bar responsible for laying out their own subviews. You could use UIView subclasses that respond to bounds changes or whatever other property should trigger a change in how their subviews are displayed and laid out. You could even do this with Auto Layout.

I'll leave this open to further discussion for anyone else who might agree or disagree with my stance.

@m1entus
Copy link
Author

m1entus commented Mar 26, 2015

Consider people like me, who want to create flexible height bar view from xib, when you are creating view from xib, there is additional container layout and it is not possible to do anything with elements, in this case you must create flexible header from code which is ugly for me.

@bryankeller
Copy link
Owner

@m1entus I'm unable to reproduce that issue with the container view in interface builder. I added the bar as a subview of the view controller's view in IB. Then I drag in labels and other subviews and connect them with IBOutlets. Finally, I setup layout attributes for them in code. There is no container view inside of the BLKFlexibleHeightBar.

@m1entus
Copy link
Author

m1entus commented Apr 7, 2015

In my case, i am subclassing UINavigationController without using xib, and i am adding BLKFlexibleHeightBar as a subview loaded from xib, [[NSBundle mainBundle] loadNibNamed:@"Blah"
owner:self options:nil]; which is not possible to load UIView without additional container.

If you don't want to add this, allow me to subclass BLKFlexibleHeightBar and modify it in subclass (make a public method which is modyfing subviews).

@bryankeller
Copy link
Owner

I'd like to reproduce your setup. Your view hierarchy looks like this, correct?

UINavigationBar
|_BLKFlexibleHeightBar
|_subview
|_subview
|_subview

You load a BLKFlexibleHeightBar from a xib and add it as a subview of UINavigationBar?

@m1entus
Copy link
Author

m1entus commented Apr 11, 2015

I added method named: viewForApplyingAttributes , if you uncomment it it will work fine, maybe you could add simmilar concept ? Sample project with problem: https://dl.dropboxusercontent.com/u/21909153/BLKFlexibleHeightBar-Sample.zip

@m1entus
Copy link
Author

m1entus commented May 3, 2015

Any progress with that ?

@bryankeller
Copy link
Owner

Thanks for the demo showing the problem. I haven't had time to take an in depth look but I hope to get around to it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants