MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / _setNativeViewFrame

Method _setNativeViewFrame

packages/core/ui/core/view/index.ios.ts:235–257  ·  view source on GitHub ↗
(nativeView: UIView, frame: CGRect)

Source from the content-addressed store, hash-verified

233 }
234
235 public _setNativeViewFrame(nativeView: UIView, frame: CGRect): void {
236 const oldFrame = this._cachedFrame || nativeView.frame;
237
238 if (!CGRectEqualToRect(oldFrame, frame)) {
239 if (Trace.isEnabled()) {
240 Trace.write(this + ' :_setNativeViewFrame: ' + JSON.stringify(IOSHelper.getPositionFromFrame(frame)), Trace.categories.Layout);
241 }
242
243 this._cachedFrame = frame;
244 this._modifyNativeViewFrame(nativeView, frame);
245
246 this._raiseLayoutChangedEvent();
247 this._isLaidOut = true;
248 } else if (!this._isLaidOut) {
249 this._cachedFrame = frame;
250
251 // Rects could be equal on the first layout and an event should be raised.
252 this._raiseLayoutChangedEvent();
253 // But make sure event is raised only once if rects are equal on the first layout as
254 // this method is called twice with equal rects in landscape mode (vs only once in portrait)
255 this._isLaidOut = true;
256 }
257 }
258
259 get isLayoutValid(): boolean {
260 if (this.nativeViewProtected) {

Callers 2

layoutNativeViewMethod · 0.95
updateOriginPointMethod · 0.95

Calls 4

isEnabledMethod · 0.80
getPositionFromFrameMethod · 0.80
writeMethod · 0.65

Tested by

no test coverage detected