2013-07-01 116 views
0

我在开发的单点触摸应用程序中有一个视图,它只有一些按钮。这个想法是,当我点击其中一个按钮时,从底部(如键盘)打开一个子视图,其中包含诸如滑块和文本视图之类的内容(每个按钮都有一个滑入的不同子视图)。用单点触摸自定义视图

我环顾四周,似乎无法找到如何做到这一点。我知道这是可能的,因为我已经在很多应用程序上看到它。

任何意见在这里将不胜感激。

+0

也许你需要的是actionsheet? – daniherculano

+0

尝试在您的视图中将'InputView'设置为'UITextView'的自定义视图。当它们中的一些将获得焦点时,将显示“InputView”而不是默认键盘。 –

回答

0

您所描述的内容听起来像是UIActionSheet。如果这不符合您的需求,创建一个新的UIView并使其显示很简单 - 只需设置其Frame属性并使用AddSubview(可能使用动画使其向上滑动)。

protected void HandleBtnActionSheetWithOtherButtonsTouchUpInside (object sender, EventArgs e) 
{ 
    actionSheet = new UIActionSheet ("action sheet with other buttons"); 
    actionSheet.AddButton ("delete"); 
    actionSheet.AddButton ("cancel"); 
    actionSheet.AddButton ("a different option!"); 
    actionSheet.AddButton ("another option"); 
    actionSheet.DestructiveButtonIndex = 0; 
    actionSheet.CancelButtonIndex = 1; 
    //actionSheet.FirstOtherButtonIndex = 2; 
    actionSheet.Clicked += delegate(object a, UIButtonEventArgs b) { 
    Console.WriteLine ("Button " + b.ButtonIndex.ToString() + " clicked"); 
    }; 
    actionSheet.ShowInView (View); 
} 

UIActionSheet