* [ios] add more note about get component method @nodanger
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/784c9f39 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/784c9f39 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/784c9f39 Branch: refs/heads/0.15-dev Commit: 784c9f398bf102c107374a9210c0d84bf082d416 Parents: 2e4ed78 Author: acton393 <zhangxing610...@gmail.com> Authored: Mon Jul 17 15:33:18 2017 +0800 Committer: acton393 <zhangxing610...@gmail.com> Committed: Mon Jul 17 15:33:18 2017 +0800 ---------------------------------------------------------------------- ios/sdk/WeexSDK/Sources/Module/WXDomModule.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/784c9f39/ios/sdk/WeexSDK/Sources/Module/WXDomModule.m ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDK/Sources/Module/WXDomModule.m b/ios/sdk/WeexSDK/Sources/Module/WXDomModule.m index e5c2ea2..c3e8e25 100644 --- a/ios/sdk/WeexSDK/Sources/Module/WXDomModule.m +++ b/ios/sdk/WeexSDK/Sources/Module/WXDomModule.m @@ -203,9 +203,10 @@ WX_EXPORT_METHOD(@selector(getComponentRect:callback:)) [callbackRsp setObject:[NSString stringWithFormat:@"Illegal parameter, no ref about \"%@\" can be found", ref] forKey:@"errMsg"]; } else { CGRect componentRect = CGRectZero; + // if current component view is not loaded or it hasn't been inserted to its superview, so the position cannot be obtained correct except width and height if ([component isViewLoaded] && component.view.superview) { componentRect = [component.view.superview convertRect:component.view.frame toView:rootView]; - }else { + } else { componentRect = component.calculatedFrame; } callbackRsp = [strongSelf _componentRectInfoWithViewFrame:componentRect];