UIToolbar简单使用

UIToolbar *toolbar = [[UIToolbaralloc]initWithFrame:CGRectMake(0,100, self.view.bounds.size.width,44)];

    [self.viewaddSubview:toolbar];

    

    UIBarButtonItem * barItem0 = [[UIBarButtonItemalloc]init];

    barItem0.title = @"barItem0";

    

    UIBarButtonItem * barItem1 = [[UIBarButtonItemalloc]init];

    barItem1.title = @"barItem1";

    

    UIBarButtonItem * barItem2 = [[UIBarButtonItemalloc]init];

    barItem2.title = @"barItem2";

    

    NSArray *barItemArr = [NSArrayarrayWithObjects:barItem0, barItem1, barItem2,nil];

    [toolbar setItems:barItemArr animated:YES];

你可能感兴趣的:(控件)