1
我想模仿警報視圖,並顯示具有半透明背景的視圖上方的兩個文本字段。問題是,當我嘗試點擊文本字段時,鍵盤顯示在我的半透明視圖後面,我無法再點擊它。有解決方案嗎?在UIWindow上添加子視圖覆蓋由textfields調用的鍵盤
這裏是我的代碼:
if (_grayView==nil) {
_grayView = [[UIView alloc]init];
_grayView.frame = [[UIScreen mainScreen]bounds];
_grayView.backgroundColor = [UIColor blackColor];
_grayView.alpha = 0.7;
[[[[UIApplication sharedApplication] windows] lastObject] addSubview:_grayView];
}
//Show the dimensions view when choosing an image
_dimensionsView.hidden = NO;
[[[[UIApplication sharedApplication] windows] lastObject] addSubview:_dimensionsView];
在_dimensionsView我有textfileds。
您的問題中沒有足夠的信息。代碼調用鍵盤在哪裏?你的UIGestureRecoginizers在哪裏分配? – Aggressor 2014-11-14 17:02:17
爲什麼你不只是提出一個模態視圖控制器? – 2014-11-14 18:11:13