Button with an image and text

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Button with an image and text

Paul Johnson
Hi,

I have a series of buttons with images on them. This is simple enough to
do (btnFoo.SetImage(UIImage.FromFile("..."), UIControlState.Normal);)

What I would like though is something like this

+--------------+
|              |
|   image      |
|              |
|   some text  |
|              |
+--------------+

Am I better off adding two child views to the button (one for the image
and one for the text) or is there a simple "all-in-one" method to do this?

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
|

Re: Button with an image and text

Nic Wise
Can you not set the title of the button? btn.SetTitle("....",
UIControlState.Normal):

Failing that, I'd make a new UIView child, and add the button (with
image) and a label to it. MAke the frame the same for everything, and
if you need to, bring the label to the front.

then just work with the UIView.

On 15 May 2013 02:45, Paul Johnson <[hidden email]> wrote:

> Hi,
>
> I have a series of buttons with images on them. This is simple enough to do
> (btnFoo.SetImage(UIImage.FromFile("..."), UIControlState.Normal);)
>
> What I would like though is something like this
>
> +--------------+
> |              |
> |   image      |
> |              |
> |   some text  |
> |              |
> +--------------+
>
> Am I better off adding two child views to the button (one for the image and
> one for the text) or is there a simple "all-in-one" method to do this?
>
> 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



--
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