答案 0 :(得分:1)
假设此屏幕具有滚动视图。 PopUpViewToAdd是您要添加的View,在添加之前对其进行初始化。这段代码将在文本字段下方添加弹出窗口,并且宽度与输入字段相同。
CGRect yOrigin = [textField.superview convertRect:textField.frame toView:ScrollView];
CGRect xOrigin = [textField.superview convertRect:textField.frame toView: ScrollView];
PopUpViewToAdd.frame = CGRectMake(xOrigin.origin.x, yOrigin.origin.y + textField.frame.size.height , selectedTextField.frame.size.width, 300);
[ScrollView addSubview:PopUpViewToAdd];