UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:barView.bounds]; toolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; toolbar.barStyle = UIBarStyleBlackTranslucent; [barView insertSubview:toolbar atIndex:0];
原文地址:http://blog.csdn.net/rainlesvio/article/details/39501777