謝謝您的閱讀,內UICollectionViewCell的UITextField不可達
我有兩個UITextFields
(有一些標籤一起)一個UICollectionViewCell
內。我可以在模擬器中選擇兩個文本字段,對於iPhone 6,6 +,5,5s,4s,全部iOS8,。
當我連接我的iPhone,iPhone 5c iOS7(非SIM卡)時,我只能選擇頂部UITextField
的左上角部分。一個答案會建議如何選擇兩個文本字段,並探討其他可能的原因,有人不能選擇文本字段,以及可能的解決方法。對於那些想知道的,我會盡快升級到ios8,只要我在ios7中使用這個應用程序100%。
解決方案我已經試過:
- Make sure the textField is inside the known superview
- 創建一個新項目,獲取工作正常,並複製一切儘可能準確
- 轉移文本字段,以便下一個在頂部
- 這有讓我在同一個小命中區域選擇新的「頂部」領域的結果。
- 選擇UICollectionView單元並自動設置第一響應者。這不起作用,因爲我希望用戶選擇使哪個字段成爲第一響應者。
- 設置所有的背景元素,以不同的顏色,以確保沒有被重疊的文本字段
- Set
UICollectionView
to be Editable - 它只有UITableViews
- 工作確保的CollectionView元素是按照正確的順序
- 複製和粘貼「良好的文本字段「,看看是否可以選擇。
- Deleting the entire
ViewController
and starting again. - 確保
UICollectionView
細胞具有 「用戶交互啓用」
我目前開設
- Heres a screenshot of the storyboard
UICollectionView: data-source & delegate = it's superview (UIViewController)
UICollectionViewCell
:有4個網點鏈接到定製細胞UITextFields
:代表被設置爲UIViewController
- 引用出口通向細胞在
UIViewController
- 一個文本框處理
EditingDidBegin
和EditingDidEnd
方法使用一個選擇器輸入另一個鍵盤
- 引用出口通向細胞在
要明確:
- 我可以讓鍵盤在模擬器上彈出,而我的手機上的小災區
- This is not about retrieving the data from text fields.
- 我能得到的測試項目工作,但主體工程不服水龍頭在
UITextFields
相關代碼 - 的UIViewController的.m
接口 - Private.m
@interface EnterFinalHRViewController()
// The current responder showing a keyboard.
@property (nonatomic, assign) id currentResponder;
文本字段的方法
- (IBAction)editingDidBegin:(UITextField *)textField {
self.currentResponder = textField;
}
- (IBAction)resignOnTap:(id)sender {
//called from a single tap on the view, gesture recognizer is present
//called when the text field says "Editing did End"
[self.currentResponder resignFirstResponder];
}
//implementation of the cell
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView
cellForItemAtIndexPath:(NSIndexPath *)indexPath{
static NSString *cellIdentifier = @"swimmerReview";
FinalHeartRateCollectionViewCell *cell = (FinalHeartRateCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath]; //reuse the cell
Lane *lane = [_lanes objectAtIndex:indexPath.section]; //lanes hold swimmers, so get the lane
Swimmer *swimmer = [lane.swimmers objectAtIndex:indexPath.row]; //swimmers are in the lane, so get the right swimmer
if (swimmer.actualSwimmerName) {
cell.swimmerFullName.text = swimmer.actualSwimmerName;
} else {
cell.swimmerFullName.text = @"Assign Swimmer";
}
cell.finalHeartRate.text = @"--";
//Person Picker is a PickerView that lets the user select a swimmer
cell.swimmerFullName.inputView = PersonPicker;
cell.averageStrokeRate.text = [NSString stringWithFormat:@"Avg SR: %.f", swimmer.strokeRateAvg];
cell.AveragePace.text = [@"Avg Pace: " stringByAppendingString: swimmer.setSplitAvg];
return cell;
}
問題
的回答會建議如何選擇這兩個文本字段,並探索其他可能的原因有人將無法選擇文本字段,以及可能的刪除方法。
快速呼籲所有在SO的貢獻者,你都是這樣的資源,並且我已經閱讀並從所有你已經回答的問題中學到了很多東西。這次我無法弄清楚。
你說得對。有一個子視圖添加到自定義UICollectionViewCell(不是我),所有我的界面元素都在裏面。在我的測試項目中,未知的子視圖重新調整爲自定義單元格的寬度,但是在我的主項目中它保持在50 x 50,裁剪並記錄名稱顯示給我。現在瞭解它爲什麼被添加,以及如何讓它擴展以填充父視圖。 – 2014-10-30 21:09:37