A couple of MTD questions

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

A couple of MTD questions

Paul Johnson
Hi,

I'm having some fun and games with MTD and wondered if anyone could
guide me on a couple of points.

I have a navigation controller set for the main app. This has the usual
sort of things on it (namely a title and backbutton) and works fine. I
have a settings view with the master MTD on. Simple enough to do

(in the controller that attaches the MTD)
dvc = new DialogViewController(null);
dvc.View.Frame = new RectangleF(0, 0, AppDelegate.Self.ScreenX,
AppDelegate.Self.ScreenY);
usersettings user = new usersettings(this);
dvc.Root = user.Root;
View.AddSubview(dvc.View);

Problem is this. If I select an option on an MTD which has a sub MTD,
the sub MTD appears under the navigation bar. How do I stop this from
happening? I can pull the sub MTD down, but it bounces back up.

My next MTD question is changing the colour of text within a section.

Currently, I'm doing this

UITextView about = new UITextView();
about.TextColor = UIColor.Blue;
about.Text = StringUtils.GetString("UserSettings.MTD.About");
var aboutInner = new Section(about);

var sect2 = new Section()
{
     new RootElement(StringUtils.GetString("UserSettings.MTD.About"))
{aboutInner,},
};

The text though is black and I'd like it to be blue. Is there a way to
do this?

Next one is launching a new view from within an MTD. Say I have an MTD
that needs to launch a non-MTD view. Is there a way to do this?

Lastly (gasps for breath!)

Can I attach the likes of a spinner selector to a MTD option?

The docs are good for but just seem to lack these bits. Sorry there are
4 questions on one email, but MTDs are damned powerful!

Paul
--
"Space," it says, "is big. Really big. You just won't believe how
vastly, hugely, mindbogglingly big it is. I mean, you may think it's a
long way down the road to the chemist's, but that's just peanuts to
space, listen..."
Hitch Hikers Guide to the Galaxy, a truly remarkable book!

_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: A couple of MTD questions

Stanley
Hi Paul

I'm new to MTD as well so this may be a case of the blind-leading-the-blind
but I'll have a crack.

For your colour issue you could try this:

var preferredHeader = new UILabel (new RectangleF (0, 0, 220, 20)){
    Font = UIFont.SystemFontOfSize (14),
    BackgroundColor = UIColor.Clear,
    TextColor = UIColor.DarkGray,
    Text = "     Your heading here"
   };
   var preferredSection = new Section(preferredHeader) { Elem1, Elem2 }

For launching another view it should be no different to loading the view
elsewhere. You could try something like this:

var btn = new StyledStringElement("Click Me"){
     Accessory = UITableViewCellAccessory.DisclosureIndicator
};
btn.Tapped += delegate() {
     var v = new YourView();
    ... perhaps do something with v ...
     this.NavigationController.PushViewController (v, true);
};

Sorry but I don't have time to look at your other queries - they look a bit
more involved :).

Cheers,
Michael Strong

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Paul Johnson
Sent: Friday, 21 June 2013 2:58 AM
To: [hidden email]
Subject: [MonoTouch] A couple of MTD questions

Hi,

I'm having some fun and games with MTD and wondered if anyone could guide me
on a couple of points.

I have a navigation controller set for the main app. This has the usual sort
of things on it (namely a title and backbutton) and works fine. I have a
settings view with the master MTD on. Simple enough to do

(in the controller that attaches the MTD) dvc = new
DialogViewController(null); dvc.View.Frame = new RectangleF(0, 0,
AppDelegate.Self.ScreenX, AppDelegate.Self.ScreenY); usersettings user = new
usersettings(this); dvc.Root = user.Root; View.AddSubview(dvc.View);

Problem is this. If I select an option on an MTD which has a sub MTD, the
sub MTD appears under the navigation bar. How do I stop this from happening?
I can pull the sub MTD down, but it bounces back up.

My next MTD question is changing the colour of text within a section.

Currently, I'm doing this

UITextView about = new UITextView();
about.TextColor = UIColor.Blue;
about.Text = StringUtils.GetString("UserSettings.MTD.About");
var aboutInner = new Section(about);

var sect2 = new Section()
{
     new RootElement(StringUtils.GetString("UserSettings.MTD.About"))
{aboutInner,},
};

The text though is black and I'd like it to be blue. Is there a way to do
this?

Next one is launching a new view from within an MTD. Say I have an MTD that
needs to launch a non-MTD view. Is there a way to do this?

Lastly (gasps for breath!)

Can I attach the likes of a spinner selector to a MTD option?

The docs are good for but just seem to lack these bits. Sorry there are
4 questions on one email, but MTDs are damned powerful!

Paul
--
"Space," it says, "is big. Really big. You just won't believe how vastly,
hugely, mindbogglingly big it is. I mean, you may think it's a long way down
the road to the chemist's, but that's just peanuts to space, listen..."
Hitch Hikers Guide to the Galaxy, a truly remarkable book!

_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch

_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: A couple of MTD questions

Nic Wise
In reply to this post by Paul Johnson
> I have a navigation controller set for the main app. This has the usual sort
> of things on it (namely a title and backbutton) and works fine. I have a
> settings view with the master MTD on. Simple enough to do
>
> (in the controller that attaches the MTD)
> dvc = new DialogViewController(null);
> dvc.View.Frame = new RectangleF(0, 0, AppDelegate.Self.ScreenX,
> AppDelegate.Self.ScreenY);
> usersettings user = new usersettings(this);
> dvc.Root = user.Root;
> View.AddSubview(dvc.View);
>
> Problem is this. If I select an option on an MTD which has a sub MTD, the
> sub MTD appears under the navigation bar. How do I stop this from happening?
> I can pull the sub MTD down, but it bounces back up.

I'm not 100% sure on what you are seeing (can you post some shots?),
but MT.D always sets the autoresizemask:

https://github.com/migueldeicaza/MonoTouch.Dialog/blob/master/MonoTouch.Dialog/DialogViewController.cs#L528

tableView = MakeTableView (UIScreen.MainScreen.Bounds, Style);
tableView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight |
UIViewAutoresizing.FlexibleWidth |
UIViewAutoresizing.FlexibleTopMargin;
tableView.AutosizesSubviews = true;

You MIGHT be able to override LoadView and change it in there, if
thats likely to be causing the problem.


> My next MTD question is changing the colour of text within a section.
>
> Currently, I'm doing this
>
> UITextView about = new UITextView();
> about.TextColor = UIColor.Blue;
> about.Text = StringUtils.GetString("UserSettings.MTD.About");
> var aboutInner = new Section(about);
>
> var sect2 = new Section()
> {
>     new RootElement(StringUtils.GetString("UserSettings.MTD.About"))
> {aboutInner,},
> };
>
> The text though is black and I'd like it to be blue. Is there a way to do
> this?

You're setting the text on the section in the sub-controller - so you
tap on "about", it loads a new one, and the header of the section in
that new one is blue (in theory)

If you want to set the color of the first "about", you might need to
make your own RootElement, and override GetCell

https://github.com/migueldeicaza/MonoTouch.Dialog/blob/master/MonoTouch.Dialog/Elements.cs#L2814

then you can set the color as you like.

> Next one is launching a new view from within an MTD. Say I have an MTD that
> needs to launch a non-MTD view. Is there a way to do this?

If you want it inside the context of the same NavigationController,
then yes: just push it like any other view.
(NavigationController.PushViewController)

If you want it outside of the context of the NavController, you can
just use PresentViewController

> Can I attach the likes of a spinner selector to a MTD option?
>

spinner as in the up down, or the thing that goes round and round to
show progress?

yes in both cases :)

--
Nic Wise
t.  +44 7788 592 806 | @fastchicken
b. http://www.fastchicken.co.nz/
_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Loading...