回答
通知觀察者看你有一個UITextField
設置代表自我。
[textField setDelegate : self];
然後使用委託
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
// call the method where u r making ur popover
}
當你開始在UITextField
寫這個委託調用。
您可以使用文本框的委託方法之一,儘快顯示您的酥料餅的文本字段開始編輯
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
[self showPopOver];
}
注: - showPoperOver是一個自定義的方法。
OR
您可以通知
UITextFieldTextDidBeginEditingNotification
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
[self showPopOverController];
}
- (void)showPopOverController
{
self.imgPicker = [[UIImagePickerController alloc] init];
self.imgPicker.delegate = self;
self.imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
_popover = [[UIPopoverController alloc] initWithContentViewController:self.imgPicker];
[_popover setDelegate:self];
[_popover presentPopoverFromRect:self.txtField.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
,你需要在.h文件中聲明
UIPopoverController *_popover;
@property (strong, nonatomic) IBOutlet UITextField *txtField;
@property (nonatomic, retain) UIImagePickerController *imgPicker;
這僅適用於iPad的
而不是ImagePicker製作您自己的ContentViewController。 – 2013-02-22 04:51:20
ThanQ幫助我。但它不適用於iphone – Sindu 2013-02-22 05:02:48
@prathyusha:我看到你以前的問題,我知道你的實際需求是什麼。 – 2013-02-22 05:04:03
- 1. UITextField編輯開始呼籲查看結束編輯
- 2. 當UITextField或UITextView開始編輯時收到通知
- 3. 當編輯開始時更改UITextField背景
- 4. UITextField始終是可編輯的
- 5. 的UITextField的光標顯示在開始編輯iPhone 6
- 6. 編輯UITextField時顯示UIPickerView
- 7. 如何使UIButton導致UITextField開始編輯文本
- 8. 調用UITextField編輯沒有開始只有一次
- 9. 當編輯在一個uitextfield上結束時檢測,但在另一個uitextfield上開始時檢測
- 10. Popover可編輯文本
- 11. Datagridview在加載時開始編輯
- 12. 編輯時UISearchController變動幅度開始
- 13. 開始編輯textview時隱藏圖像
- 14. HTML編輯器 - 同時編輯開始和結束標記
- 15. 如何編輯的UITextField
- 16. 的UITextField不編輯正確
- 17. 開始編輯插入
- 18. UITextField在編輯時更改字體
- 19. 編輯時不顯示UITextField陰影
- 20. 正在編輯UITextField時切換UITextAutoCorrectionType
- 21. 如何在編輯時更改UITextField
- 22. popover可編輯的工具提示
- 23. UITextField編輯問題 - iPhone SDK
- 24. UITextField編輯後檢查空
- 25. ios UITextField使用uidatepicker編輯
- 26. XPages時間編輯框 - 設置開始時間
- 27. 編輯後(編輯時居中),UITextField中的文本向上移動
- 28. Chrome編輯器在編輯css時始終打開並關注控制檯
- 29. 無法打開編輯器:編輯器無法初始化
- 30. 編輯開始時更改QStandardItem的文本
我們可以在iphone中使用popover – Sindu 2013-02-22 05:25:39
no popover是隻爲ipad – Kasaname 2013-02-22 05:26:14
,但你總是可以創建自定義popover使用視圖和加載表中的意見 – Kasaname 2013-02-22 05:26:47