Toolbar: ToolBar
Toolbar item: Bar button Item Adjustment button position adjustment: Fixed space bar button Item Adjustment button Position Flexible adjustment: Flexible Space Bar Button Toolbar toolbar is the property of view You can add toolbar buttons on the Toolbar Bar button item (which can be custom-custom or System-Barbuttonsystemitem), and the view controller can manipulate the contents of the image from the toolbar item. ButtonBar Button Item has three kinds of Style:Plain (can use custom picture),boarded and done . Other properties are words too literally. To make the button unavailable, change the enable property. Tool Bar can also make some adjustments (mainly to adjust style). It is important to note that abutton of type Plain is not a title, that is, Null. To illustrate,The fixed space bar button item is a constant (also adjustable) spacing, while the flexible space bar button item automatically adjusts the existing button to maximize the space of the toolbar. The point is: we can use ToolbarItems to set the button on the toolbar, the General app see there are 3-4 options such as "Home", "settings" These can be loaded as Uibarbuttonitem object on this toolbar, of course, From the ToolbarItems name, it has a "s", so we have to separate the Uibarbuttonitem object into an array, and then assign this array to ToolbarItems. Or add all the tool items to the toolbar using the Settoolbaritems method, and finally add ToolbarItems to the toolbar toolbar. For example, to set the display item for a toolbar by ToolbarItems, an instance of Uibarbuttonitem in the array//barbuttonitem instanceUIBarButtonItem *item1 = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:nil];UIBarButtonItem *item2 = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:self action:nil];//item的间隔,不会显示出来,会自动计算间隔,就是上面的调节UIBarButtonItem *spaceItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];Put toolbar items: Barbuttonitem and adjustment instances into the array
Nsarray *arr1=[[nsarray Alloc]initwithobject:item1,spaceitem,item2,spaceitem,nil];
Placing a button on a toolbar with the ToolbarItems property
Self.toolbaritems = arr;
Or put the button on the toolbar with the Settoolbaritems method
[Self Settoolbaritems:arr];
Several relations of Ios:uitoolbar, ToolbarItems and Barbuttonitem