2011-07-19 65 views

回答

0

只是用它嘗試:

在.h文件中:

UIToolbar* toolbar; 

在.m文件

UIBarButtonItem *actionButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(doAction)]; 
    toolbar   = [UIToolbar new]; 
    toolbar.barStyle = UIBarStyleDefault; 

    [toolbar sizeToFit]; 
    CGFloat toolbarHeight = [toolbar frame].size.height; 
    CGRect mainViewBounds = appDel.window.bounds; 
    [toolbar setFrame:CGRectMake(CGRectGetMinX(mainViewBounds), 
           438, 
           CGRectGetWidth(mainViewBounds), 
           toolbarHeight)];  

    [[[UIApplication sharedApplication] keyWindow] addSubview:toolbar]; 
相關問題