Reputation: 7479
I am trying to use this:
Adding a Monotouch.Dialog to a standard view
I can see the view elements when I do this... however clicking on one of the radio elements does not do anything (showing the checkbox for example). Not sure what I am doing wrong.
Here is the code that I am using inside ViewDidLoad()
var rootElement = new RootElement("Question Text", new RadioGroup("answer", 0))
{
new Section()
{
new RadioElement("Answer A", "answer"),
new RadioElement("Answer B", "answer"),
new RadioElement("Answer C", "answer"),
new RadioElement("Answer D", "answer")
}
};
_questionDialogViewController = new DialogViewController(rootElement);
_questionDialogViewController.View.BackgroundColor = UIColor.Clear.FromHexString(AppDelegate.EventModel.MainBackgroundColor);
_questionDialogViewController.View.Frame = new RectangleF(0, 250, 864, 500);
View.AddSubview(_questionDialogViewController.View);
Upvotes: 1
Views: 109
Reputation: 7479
I found that it was an issue with the dialog controller expanding past the edge of the viewcontroller.
The solution was to add a middle UIView as a container to force the DialogController to stay within the correct bounds.
The correct code ended up being:
var rootElement = new RootElement("Question Text", new RadioGroup("answer", 0))
{
new Section()
{
new RadioElement("Answer A", "answer"),
new RadioElement("Answer B", "answer"),
new RadioElement("Answer C", "answer"),
new RadioElement("Answer D", "answer")
}
};
_questionDialogViewController = new DialogViewController(rootElement);
_questionDialogViewController.View.BackgroundColor = UIColor.Clear.FromHexString(AppDelegate.EventModel.MainBackgroundColor);
_questionDialogViewController.View.Frame = new RectangleF(0, 0, 964, 500);
var answerContainer = new UIView(new RectangleF(30, 150, 964, 500));
answerContainer.AddSubview(_questionDialogViewController.View);
View.AddSubview(answerContainer);
Upvotes: 1