UIToolBar

简介: UIToolBar
   // Do any additional setup after loading the view from its nib.
    UIBarButtonItem *one = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:nil action:nil];  
    UIBarButtonItem *two = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:nil action:nil];  
    UIBarButtonItem *three = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:nil action:nil];  
    UIBarButtonItem *four = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:nil action:nil];  
    UIBarButtonItem *flexItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];  
    NSArray *toolBarItems =[NSArray arrayWithObjects:flexItem, one, flexItem, two, flexItem, three, flexItem, four, flexItem, nil]; 
    toolbar = [[UIToolbar alloc] init];
    [toolbar setItems:toolBarItems animated:NO];
    [toolbar sizeToFit];
    CGFloat toolbarHeight = [toolbar frame].size.height;
    CGRect viewBounds = self.view.bounds;
    CGFloat rootViewHeight = CGRectGetHeight(viewBounds);
    CGFloat rootViewWidth = CGRectGetWidth(viewBounds);
    CGRect rectArea = CGRectMake(0, rootViewHeight - toolbarHeight, rootViewWidth, toolbarHeight);
    [toolbar setFrame:rectArea];
    [self.view addSubview:toolbar];
相关文章
|
6月前
|
iOS开发 UED 容器
navigationController 的使用详解
navigationController 的使用详解
|
iOS开发
UISearchBar去除背景
UISearchBar去除背景
155 0
UISearchBar去除背景
UITableViewCell和UICollectionViewCell自适应高度
UITableView和UICollectionView想通,此处就已UITableView为例
229 0
UITableViewCell和UICollectionViewCell自适应高度
UINavigationBar-使用总结
UINavigationBar-使用总结
124 0
UIActionSheet,UIAlertView,UIAlertController的详细说明
UIActionSheet,UIAlertView,UIAlertController的详细说明
123 0
UIActionSheet,UIAlertView,UIAlertController的详细说明