Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ iOS used in the development --UITabBarController tag controller     - A list of the basics of Python, Ganso, Dictionary (Programming)

- To install and deploy Apache under the CentOS (Server)

- HAProxy Windows version of the compiler and its application in the CORS (Server)

- MySQL service failed to start thinking of settlement under CentOS7 (Database)

- Automate deployment of Docker-based Rails applications (Server)

- MySQL Server Time Synchronization Problem (Database)

- Oracle 11g 10g induced into error (Database)

- Each catalog Detailed Linux (Linux)

- WinSCP to transfer text files will automatically convert the format (Linux)

- Linux system security knowledge (Linux)

- Linux using DenyHosts prevents ssh cracks (Linux)

- How to install MySQL on Linux Dock (Database)

- Get and Post requests Comments (Linux)

- C ++ you can become a new scripting language (Programming)

- The multiplexed signal driving IO (Programming)

- Linux Getting Started tutorial: Experience Xen Virtual Machine chapter (Linux)

- Squid proxy server (Server)

- Cobbler automatic mass deployment of CentOS 6 and CentOS 7 (Linux)

- Share and show your code on GitHub (Linux)

- Install Web-based monitoring tool: Linux-Dash (Server)

  iOS used in the development --UITabBarController tag controller
  Add Date : 2018-11-21      
  First. Introduction

Similar to the navigation controller, the controller is used to label a UI control management view controller in its internal package a tab bar, and navigation is a different management style navigation is vertical, using push and pop switch management controller, the label is horizontal, by switching the controller to change the label, we were used to tabBar general application as the root view controller, in which add navigation, navigation in the management of the ViewController.
Second, create a controller tag

Follow the steps below, we can be very easy to create a TabBarController:

UITabBarController * tabBar = [[UITabBarController alloc] init];
    NSMutableArray * controllerArray = [[NSMutableArray alloc] init];
    for (int i = 0; i <4; i ++) {
        UIViewController * con = [[UIViewController alloc] init];
        [Con loadViewIfNeeded];
        con.view.backgroundColor = [UIColor colorWithRed: arc4random ()% 255 / 255.0 green: arc4random ()% 255 / 255.0 blue: arc4random ()% 255 / 255.0 alpha: 1];
        con.tabBarItem.image = [UIImage imageNamed: @ "btn_publish_face_a.png"];
        con.tabBarItem.title = [NSString stringWithFormat: @ "% d", i + 1];
        con.title = [NSString stringWithFormat: @ "% d", i + 1];
        [ControllerArray addObject: con];
    tabBar.viewControllers = controllerArray;
    [Self presentViewController: tabBar animated: YES completion: nil];

By clicking the button below the tab, you can easily switch controller. If we count more than 4 controllers, the system will be more of us to create a navigation sequence controller and can be adjusted through the system comes with the editor

Three, UITabBarController properties and methods

viewController array // Management
@property (nullable, nonatomic, copy) NSArray <__ kindof UIViewController *> * viewControllers;
- (Void) setViewControllers: (NSArray <__ kindof UIViewController *> * __nullable) viewControllers animated: (BOOL) animated;
// Selected ViewControlle
@property (nullable, nonatomic, assign) __kindof UIViewController * selectedViewController;
// Set the selected number by ViewController
@property (nonatomic) NSUInteger selectedIndex;
// When viewController more than four to get the "More" tab navigation controller
@property (nonatomic, readonly) UINavigationController * moreNavigationController;
// Set this property can customize the order in view of the controller, as described above in the second figure, the default is all
@property (nullable, nonatomic, copy) NSArray <__ kindof UIViewController *> * customizableViewControllers;
// Tag controller carve loaded tab bar
@property (nonatomic, readonly) UITabBar * tabBar NS_AVAILABLE_IOS (3_0);
@property (nullable, nonatomic, weak) id delegate;
Fourth, on the tab bar TabBar

Since some of the attributes defined by the tab bar, so that we can be more flexible use tabBar.

1, UITabBar properties and methods

Settings tab:

@property (nullable, nonatomic, copy) NSArray * items;
// Set the selected label
@property (nullable, nonatomic, assign) UITabBarItem * selectedItem;
- (Void) setItems: (nullable NSArray *) items animated: (BOOL) animated;

Set a custom tab order:

// This method is called a pop-up similar to the above screenshot of the second controller, we can exchange the order of the layout of the label
- (Void) beginCustomizingItems: (NSArray *) items;
// Complete label layout
- (BOOL) endCustomizingAnimated: (BOOL) animated;
// Is whether custom label layouts
- (BOOL) isCustomizing;

Color settings tabBar Related:

// Set the color rendering, and will affect the selected font rendering pattern
@property (null_resettable, nonatomic, strong) UIColor * tintColor;
// Set the color of the navigation bar
@property (nullable, nonatomic, strong) UIColor * barTintColor;

Set a background image:

// Set the navigation bar background pattern
@property (nullable, nonatomic, strong) UIImage * backgroundImage;
// Set the selected a label, select the label behind this pattern prompt appears behind the item set pattern
@property (nullable, nonatomic, strong) UIImage * selectionIndicatorImage;
// Set the background pattern shadow
@property (nullable, nonatomic, strong) UIImage * shadowImage

TabBar label macroscopic properties:

// Set the label item position pattern
@property (nonatomic) UITabBarItemPositioning itemPositioning;
// Enum as follows
typedef NS_ENUM (NSInteger, UITabBarItemPositioning) {
    UITabBarItemPositioningAutomatic, // automatically
    UITabBarItemPositioningFill, // full
    UITabBarItemPositioningCentered, // Center
// Set the item width
@property (nonatomic) CGFloat itemWidth;
// Set the item spacing
@property (nonatomic) CGFloat itemSpacing;

Similar to the navigation bar, you can also set the style and transparency effects tabBar:

// Sub-style black and white
@property (nonatomic) UIBarStyle barStyle;
// Whether transparency effects
@property (nonatomic, getter = isTranslucent) BOOL translucent;
 2, UITabBarDelegate

// Called when selected tag
- (Void) tabBar: (UITabBar *) tabBar didSelectItem: (UITabBarItem *) item;
// When will begin to edit tags
When // has started to edit the label; (NSArray *) items: (UITabBar *) tabBar willBeginCustomizingItems: (void) tabBar -
- (Void) tabBar: (UITabBar *) tabBar didBeginCustomizingItems: (NSArray *) items;
// When to enter edit mode
- (Void) tabBar: (UITabBar *) tabBar willEndCustomizingItems: (NSArray *) items changed: (BOOL) changed;
When // has entered edit mode
- (Void) tabBar: (UITabBar *) tabBar didEndCustomizingItems: (NSArray *) items changed: (BOOL) changed;
Fifth, look UITabBarItem

And NavigationItem Similarly, item on the tab bar can also be customized, some of the methods below.

Initialization method:

// Created by title and patterns
- (Instancetype) initWithTitle: (nullable NSString *) title image: (nullable UIImage *) image tag: (NSInteger) tag;
- (Instancetype) initWithTitle: (nullable NSString *) title image: (nullable UIImage *) image selectedImage: (nullable UIImage *) selectedImage;
// Create a system type
- (Instancetype) initWithTabBarSystemItem: (UITabBarSystemItem) systemItem tag: (NSInteger) tag;

UITabBarSystemItem enumerated as follows:

typedef NS_ENUM (NSInteger, UITabBarSystemItem) {
    UITabBarSystemItemMore, // more icons
    UITabBarSystemItemFavorites, // favorite icon
    UITabBarSystemItemFeatured, // feature icon
    UITabBarSystemItemTopRated, // Advanced icon
    UITabBarSystemItemRecents, // Recent icon
    UITabBarSystemItemContacts, // contact icon
    UITabBarSystemItemHistory, // History icon
    UITabBarSystemItemBookmarks, // Books icon
    UITabBarSystemItemSearch, // Find icon
    UITabBarSystemItemDownloads, // download icon
    UITabBarSystemItemMostRecent, // record icon
    UITabBarSystemItemMostViewed, // View all Icon

UITabBarItem common attributes:

// Set the selected pattern
@property (nullable, nonatomic, strong) UIImage * selectedImage;

This property can be set below the header text item:

con.tabBarItem.badgeValue = @ "1";

// Set the title of the position offset
@property (nonatomic, readwrite, assign) UIOffset titlePositionAdjustment;

Since UITabBarItem inherited from UIBarItem, there can be set using the following property:

@property (nullable, nonatomic, copy) NSString * title;
// Pattern
@property (nullable, nonatomic, strong) UIImage * image;
// Horizontal pattern screen when
@property (nullable, nonatomic, strong) UIImage * landscapeImagePhone;
// Shift pattern position
@property (nonatomic) UIEdgeInsets imageInsets;
// Horizontal screen pattern position offset when
@property (nonatomic) UIEdgeInsets landscapeImagePhoneInsets;
// Set and get the title font properties
- (Void) setTitleTextAttributes: (nullable NSDictionary *) attributes forState: (UIControlState) state;
- (Nullable NSDictionary *) titleTextAttributesForState: (UIControlState) state;
- Root of AVL Tree- achieve balanced search trees AVL tree (Programming)
- CentOS and RHEL to install IPython 0.11 (Linux)
- Linux SSH commands (Linux)
- Oracle conditional select statements and looping statements (Database)
- Shell Programming points to note about the function (Programming)
- RHEL 5.7 Yum configure local source [Errno 2] No such file or directory (Linux)
- Sorting algorithm of dichotomy (binary) insertion sort algorithm (Programming)
- Getting the Linux shell variable test (Programming)
- Using nmcli commands to manage network in RedHat / CentOS 7.x (Linux)
- Eclipse, Tomcat configuration JNDI connection Oracle data source example (Server)
- Setting Hibernate connection MySQL database connection pool coding (Database)
- CentOS install video converter FFmpeg and cutting tools segmenter (Linux)
- Vim Common Command Summary (Linux)
- DIY security of Linux platform (Linux)
- Android imageView in the Src and Background (Programming)
- CentOS 5.x install Lua 5.2.3 error (LIBS = -lncurses) (Linux)
- Linux IO redirection (Linux)
- Nginx start, stop, smooth start, smooth upgrade (Server)
- Learning how to teach safety system to prevent your own IP leakage (Linux)
- Composition and dynamic memory allocation C program (Programming)
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.