获取到View的绝对位置

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的绝对位置)