Comments (4)
Yep, that should probably exist.
from reactivecocoalayout.
I don't think so. Setting center
is notoriously error-prone. There are two specific problems with it in RCL:
- It's really easy for views to end up on half pixels.
rcl_bounds
andrcl_frame
perform automatic alignment of the rectangles they're set to, but it's more difficult to align the center point. If you try to align the center by using the view's entire frame, what happens if the size is modified later in the same run loop iteration? It's just tricky. - RCL very much favors building up a complete frame and setting that in one fell swoop, because weird behaviors can result if different pieces of the frame are set separately.
It's a better idea to just -alignCenter: the desired bounds, so that you have a signal which represents the total layout of the view.
from reactivecocoalayout.
Isn't the center
property of a UIView
derived from frame
, not from bounds
? Will -alignCenter:
used on rcl_frame
get the desired result even if a transform has been applied to the view (or it's layer)?
If true, then this should work fine.
from reactivecocoalayout.
So I'm trying this out with code such as
RACSignal *superBoundsMidWidth = self.view.rcl_boundsSignal.centerX;
RACSignal *superBoundsMidHeight = self.view.rcl_boundsSignal.centerY;
RAC(videoPlayer.rcl_frame) = [videoPlayer.rcl_frameSignal alignCenter:[RACSignal pointsWithX:superBoundsMidWidth Y:superBoundsMidHeight]];
and it appears to be working for now. Closing.
from reactivecocoalayout.
Related Issues (20)
- when I set rcl_top , why the height and width changed ? HOT 1
- Add Carthage compatibility badge to the README
- Split animation behaviors into a separate library HOT 3
- Concat after animation HOT 1
- -rcl_frameSignal etc al should complete on object dealloc HOT 1
- NSView.rcl_baselineSignal does not update
- ld: library not found for -lReactiveCocoaLayout iOS HOT 1
- Add bootstrap and cibuild scripts
- Why can't I do both alignTop and alignRight? HOT 2
- Why can't I use signals that return constant numbers in my layout chain? HOT 9
- ResizingWindow demo has a lot of layer-backing artifacts HOT 1
- ResizingWindow throws exceptions if the window is sized too small
- A signal equivalent to AVMakeRectWithAspectRatioInsideRect ? HOT 6
- (NS | UI)EdgeInsets operators HOT 6
- Equally Space Views HOT 2
- CGRectInset() returning NaN values HOT 9
- Adopt the Flexbox spec. It's been much improved over the past year. HOT 2
- Create New Tag HOT 3
- RCL doesn't respect `flipped` coordinate space? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reactivecocoalayout.