美文网首页iOS Developer
获取到View的绝对位置

获取到View的绝对位置

作者: 乱不乱步 | 来源:发表于2016-12-21 11:09 被阅读110次

CGRect rect=[sender.view convertRect:sender.view.bounds toView:[UIApplication sharedApplication].keyWindow];

UIView *view = [[UIView alloc] initWithFrame:rect];

[[UIApplication sharedApplication].keyWindow addSubview:view];

NSLog(@"%f,%f,%f,%f",rect.origin.x,rect.origin.y,rect.size.width,rect.size.height);

相关文章

网友评论

    本文标题:获取到View的绝对位置

    本文链接:https://www.haomeiwen.com/subject/qlgbpttx.html