(008)UIBarButtonItem工具栏按钮

- (void)viewDidLoad
{
    [super viewDidLoad];
        
    self.navigationController.navigationBar.tintColor = [UIColor redColor];//改变导航条颜色
    
    ////////////////////工具条按钮///////////////////////
    UIBarButtonItem *button1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:nil];
    
    UIBarButtonItem *space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
    
    UIBarButtonItem *button2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemUndo target:self action:nil];
    
    NSArray *toolButtons = [NSArray arrayWithObjects:button1,space,button2, nil];
    
    [self.navigationController setToolbarHidden:NO animated:YES];
    [self setToolbarItems:toolButtons animated:YES];
}

........
........
........

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    Class class = NSClassFromString([items objectAtIndex:indexPath.row]);
    id viewController = [[class alloc] init];
    if(viewController)
    {
        self.navigationController.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:viewController animated:YES];
    }
}
TopMenuController

 

posted @ 2013-08-19 19:33  雪中飞雁  阅读(62)  评论(0)    收藏  举报