Repository: incubator-weex Updated Branches: refs/heads/0.15-dev 68e694160 -> ff12fe5a9
* [ios] get component rectangle when component view is not ready Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/2e4ed781 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/2e4ed781 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/2e4ed781 Branch: refs/heads/0.15-dev Commit: 2e4ed781794f84d083b2e5b2f5b72ac78bf7d209 Parents: 2c435d1 Author: acton393 <zhangxing610...@gmail.com> Authored: Mon Jul 17 15:11:36 2017 +0800 Committer: acton393 <zhangxing610...@gmail.com> Committed: Mon Jul 17 15:11:36 2017 +0800 ---------------------------------------------------------------------- ios/sdk/WeexSDK/Sources/Module/WXDomModule.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2e4ed781/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 544bc71..e5c2ea2 100644 --- a/ios/sdk/WeexSDK/Sources/Module/WXDomModule.m +++ b/ios/sdk/WeexSDK/Sources/Module/WXDomModule.m @@ -202,7 +202,12 @@ WX_EXPORT_METHOD(@selector(getComponentRect:callback:)) [callbackRsp setObject:@(false) forKey:@"result"]; [callbackRsp setObject:[NSString stringWithFormat:@"Illegal parameter, no ref about \"%@\" can be found", ref] forKey:@"errMsg"]; } else { - CGRect componentRect = [component.view.superview convertRect:component.view.frame toView:rootView]; + CGRect componentRect = CGRectZero; + if ([component isViewLoaded] && component.view.superview) { + componentRect = [component.view.superview convertRect:component.view.frame toView:rootView]; + }else { + componentRect = component.calculatedFrame; + } callbackRsp = [strongSelf _componentRectInfoWithViewFrame:componentRect]; [callbackRsp setObject:@(true)forKey:@"result"]; }