UIToolBar 背景图片设置

    UIToolbar *toolBar = [[[UIToolbar alloc]initWithFrame:CGRectMake(0, self.scrollView.frame.size.height, self.view.frame.size.width, 30)] autorelease];
    
    UIImage *root_image = [UIImage imageNamed:@"toolbarBackground.png"];
    
    if ([toolBar respondsToSelector:@selector(setBackgroundImage:forToolbarPosition:barMetrics:)]) {
        [toolBar setBackgroundImage:root_image forToolbarPosition:0 barMetrics:0];         //仅5.0以上版本适用
    }else{
        toolBar.barStyle = UIToolbarPositionTop;
    }

posted @ 2013-01-15 11:47  沙影无痕  阅读(239)  评论(0编辑  收藏  举报