Looks like you are doing it right. Have a look here too

https://github.com/migueldeicaza/TweetStation/blob/master/TweetStation/UI/Web.cs

however, are those images set as content in MD? (right click -> Build
Action -> Content). If they dont exist in the bundle, then they will
never show. Maybe try it with one of the system defined ones and see
if that works, eg:

new UIBarButtonItem(UIBarButtonSystemItem.Refresh, delegate {

??

On Fri, Jun 22, 2012 at 7:03 PM, Chris_M <[email protected]> wrote:
>
> I'm still playing with different button and navigation options to see how
> things work and what will work for my needs. Today I'm working with a
> UIToolBar at the bottom of my main view. Following what I've read in various
> examples, I wrote the following, which works in that the bar and the buttons
> display and you can click 'em and they launch the new view as intended. The
> problem is that I want to use images for the buttons, and the images are not
> displaying (I can get them to display as custom UIBottons but not as
> UIBarButtons). Here's what I've got so far:
>
> toolbar = new UIToolbar (new RectangleF (0
>                                        , toolbarVert
>                                        , this.View.Frame.Width, 
> toolbarHeight));
>
> // 1st toolbar button: Map Regions
>
> UIBarButtonItem regionsTBB = new UIBarButtonItem (UIImage.FromFile
> ("images/regionsButton.png"), UIBarButtonItemStyle.Plain, Action);
>
> // 2nd toobar button: Mail TBB
>
> UIBarButtonItem mailTBB = new UIBarButtonItem (UIImage.FromFile
> ("images/mailButton.png"), UIBarButtonItemStyle.Plain, Action);
>
> // 3rd toobar button: TBB Website
>
> UIBarButtonItem websiteTBB = new UIBarButtonItem (UIImage.FromFile
> ("images/websitButton.png"), UIBarButtonItemStyle.Plain, Action);
>
> // 4th toolbar button: Help
>
> UIBarButtonItem helpTBB = new UIBarButtonItem (UIImage.FromFile
> ("images/helpButton.png"), UIBarButtonItemStyle.Plain, Action);
>
> // create the items array
> UIBarButtonItem[] items = new UIBarButtonItem[] {
>                                regionsTBB, mailTBB, websiteTBB, helpTBB };
>
> // add the items to the toolbar
> toolbar.SetItems (items, true);
>
>
> this.View.AddSubview (toolbar);
>
> (Action is an event handling method.)
>
> Like I said, so far everything here works as intended except that the
> buttons are not displaying the images as intended. The code compiles without
> error or warnings.
>
> I'm guessing that the UIBarButtonItemStyle.Plain part is overriding the
> UIImage.FromFile part (maybe?), but every UIBarButtonItem constructor that
> includes UIImage.FromFile requires a UIBarButtonItemStyle as the second
> argument. The three options listed in the API are Plain, Bordered, and Done.
> I've tried all three just to see, and the image doesn't display as the
> button for any of them.
>
> What am I doing wrong? How do I get the UIImage.FromFile thing to work with
> these UIBarButtonItems?
>
> My second question is about positioning buttons on the toolbar. Are there
> any options other than using the Flexible and Fixed Space bar button items?
>
>
> --Chris
>
>
> --
> View this message in context: 
> http://monotouch.2284126.n4.nabble.com/UIToolBar-Button-Question-tp4655537.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch



-- 
Nic Wise
t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

Earnest: Self-employed? Track your business expenses and income.
http://earnestapp.com
Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to