我已經創造了一種在用戶輸入一個電話number.How的EntryElement我可以在元素的末尾添加一個按鈕,以便用戶可以按下按鈕並撥打電話?添加按鈕EntryElement
回答
您需要創建一個新的元素是EntryElement的子類,重寫獲得Cell方法,並添加到accessoryView的按鈕。
我不知道如何在對話完成後回到應用程序,然後看看這個。 http://stackoverflow.com/questions/9264065/is-it-possible-to-go-back-automatically-into-the-application-after-calling-a-num – MemoDreamer 2012-03-07 08:25:35
小區的物業accessoryView的是空。相反,我將該按鈕添加到單元格的子視圖中,作爲_cell.Subviews [0] .AddSubview(btn)'。這是一樣的嗎? – 2012-03-13 10:19:25
我知道這並不完全回答這個問題,但我奮鬥了很長一段時間,直到我發現@Janub的答案,讓我在正確的軌道上。這是我目前正在工作的代碼。
public class NextNumericCell : EntryElement
{
readonly EventHandler handler;
public NextNumericCell (string caption, string placeholder, string value, EventHandler onClick) : base(caption,placeholder,value)
{
handler = onClick;
}
protected override UITextField CreateTextField (CGRect frame)
{
var textField = base.CreateTextField (frame);
var toolBar = new UIToolbar (new CGRect (0, 0, frame.Width, 35));
var spacerButton = new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace);
var buttonTitle = ReturnKeyType == null ? "SetButtonTitle" : ReturnKeyType.ToString();
var nextButton = new UIBarButtonItem (buttonTitle, UIBarButtonItemStyle.Plain, handler);
toolBar.Items = new UIBarButtonItem [] { spacerButton, nextButton };
textField.InputAccessoryView = toolBar;
return textField;
}
}
- 1. 添加按鈕
- 2. 添加TR按鈕
- 3. 按鈕添加列?
- 4. 基於按鈕值添加類按鈕
- 5. 添加自定義按鈕的UITabBarController(中間添加按鈕)
- 6. 將按鈕添加到BrowseFragment
- 7. AngularJS添加/使用按鈕
- 8. JQGrid添加默認按鈕
- 9. JavaFX動態添加按鈕
- 10. 將按鈕添加到ListActivity
- 11. 添加「報價」按鈕,jwysiwyg
- 12. 在UINavigationController上添加按鈕
- 13. disable +減去添加按鈕
- 14. 將按鈕添加到QTableview
- 15. 添加按鈕事件!
- 16. 添加風扇按鈕
- 17. 添加複選框按鈕
- 18. 添加按鈕的TabPanel
- 19. 添加圖像到按鈕
- 20. 將按鈕添加到infoWindow
- 21. 添加關閉按鈕
- 22. 將按鈕添加到UIScrollview
- 23. 添加右按鈕在NavigationController
- 24. 隱藏添加按鈕
- 25. CMB 2'添加新按鈕'
- 26. 將按鈕添加到UIDatePicker
- 27. 將按鈕添加到UITableView
- 28. 添加類按鈕jQuery中
- 29. 按鈕未添加到jframe
- 30. 將UIGesture添加到按鈕
爲什麼不作出回答而不是評論?這正是要做的事情! – Krumelur 2012-03-06 18:36:43