Skip to content

Media queries#203

Merged
tombenner merged 4 commits intotombenner:masterfrom
phatmann:media-queries
Jan 23, 2014
Merged

Media queries#203
tombenner merged 4 commits intotombenner:masterfrom
phatmann:media-queries

Conversation

@phatmann
Copy link
Copy Markdown
Contributor

This pull request supports @media queries with the parameters (orientation: ipad | iphone) or (device: landscape | portrait). They can be combined with and. A @media block can contain a combination of variable definitions and rules. The updated README contains examples.

Also included:

  • The orientation notification is now sent when the interface orientation changes, rather than the device orientation.
  • For the orientation @media query I needed some way to re-render. However, the registeredObjects array was causing memory leaks and did not handle the case where a stylesheet change affected unrendered objects. I did some timing tests and discovered that walking the visible views took the same amount of time as using registeredObjects. Therefore I removed the registeredObjects functionality, both for handling @media orientation changes and auto-update.

Fixes #3 and #180.

In my timing tests, walking the visible views was about the same amount of time as using registered objects. Since using registered objects was causing memory leaks and did not handle all stylesheet changes, it made sense to remove them.
@phatmann
Copy link
Copy Markdown
Contributor Author

@tombenner, this pull request is the culmination of my parsing work. I have tried the new @media queries on the app I am developing and it works great. We use settings that are per-device and per-orientation, so this change finally allows us to completely specify all of our styles using NUI.

Let me know if you have any questions or anything stopping this pull request from getting merged.

tombenner added a commit that referenced this pull request Jan 23, 2014
@tombenner tombenner merged commit ea2bba2 into tombenner:master Jan 23, 2014
@tombenner
Copy link
Copy Markdown
Owner

This is just fantastic, @phatmann. Many thanks for this, as well as your other contributions! This is a huge boon to everyone who uses NUI. Thanks!

@phatmann phatmann deleted the media-queries branch January 23, 2014 18:06
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.

@media Queries to Target iPad / iPhone, Orientation, Auto-Layout Constraints

2 participants