Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Tools & Utilities

Reply
 
LinkBack Thread Tools Display Modes
Old 08-24-2011, 05:32 AM   #1 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 1
JollyIT is on a distinguished road
Default UIToolbar

Hi all,

I created my toolbar on the bottom of the screen above the Tab Bar.

I added a toolbar background but now the button item haven't the same background. They have the default style.

Code:
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    //Initialize the toolbar
    toolbar = [[UIToolbar alloc] init];
    toolbar.barStyle = UIBarStyleBlack;
    [toolbar insertSubview:[[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"toolBar.png"]] autorelease] atIndex:0];

    
    //Set the toolbar to fit the width of the app.
    [toolbar sizeToFit];
    
    //Calculate the height of the toolbar
    CGFloat toolbarHeight = [toolbar frame].size.height;
    
    //Get the bounds of the parent view
    CGRect rootViewBounds = self.parentViewController.view.bounds;
    
    //Get the height of the parent view.
    CGFloat rootViewHeight = CGRectGetHeight(rootViewBounds);
    
    //Get the width of the parent view,
    CGFloat rootViewWidth = CGRectGetWidth(rootViewBounds);
    
    //Create a rectangle for the toolbar
    CGRect rectArea = CGRectMake(0, rootViewHeight - toolbarHeight, rootViewWidth, toolbarHeight);
    
    
    //Reposition and resize the receiver
    [toolbar setFrame:rectArea];
    

    

    //Create a button
     UIBarButtonItem *infoButton = [[UIBarButtonItem alloc]
                                   initWithTitle:@"Vedi sulla mappa" style:UIBarButtonItemStyleBordered target:self action:@selector(info_clicked:)];
    
    
     UIBarButtonItem *calButton = [[UIBarButtonItem alloc]
                                   initWithTitle:@"Ricorda Evento" style:UIBarButtonItemStyleBordered target:self action:@selector(info_clicked:)];
    
    
     UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
    
    
    
    //self.navigationController.toolbarItems = buttonArray;
    
    [toolbar setItems:[NSArray arrayWithObjects:infoButton, flexibleSpace, calButton, nil]];
    
    [infoButton release];
    [flexibleSpace release];
    [calButton release];
    
    //Add the toolbar as a subview to the navigation controller.
    [self.navigationController.view addSubview:toolbar];
    
    [[self tableView] reloadData];
    
}


How to solve the issue?
JollyIT is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 403
11 members and 392 guests
chemistry, Gi-lo, ipodphone, mistergreen2011, pipposanta, QuantumDoja, Retouchable, RobTaku, SLIC, tim0504
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,679
Threads: 94,129
Posts: 402,925
Top Poster: BrianSlick (7,990)
Welcome to our newest member, xzoonxoom
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 08:31 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0