UITabBarController使用详解

GPU运维面试题 【代码】GPU运维面试题。 阅读详情

  UITabBarController是IOS中很常用的一个viewController,例如系统的闹钟程序,ipod程序等。UITabBarController通常作为整个程序的rootViewController,而且不能添加到别的container viewController中。

  首先我们看一下它的view层级图:

一、手动创建UITabBarController

  最常见的创建UITabBarController的地方就是在application delegate中的 applicationDidFinishLaunching:方法,因为UITabBarController通常是作为整个程序的rootViewController的,我们需要在程序的window显示之前就创建好它,具体步骤如下:

  1、创建一个UITabBarController对象

  2、创建tabbarcontroller中每一个tab对应的要显示的对象

  3、通过UITabBarController的viewController属性将要显示的所有content viewcontroller添加到UITabBarController中

  4、通过设置UITabBarController对象为window.rootViewController,然后显示window

  下面看一个简单的例子:

复制代码
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    
   SvTabBarFirstViewController *viewController1, *viewController2;

    viewController1 = [[SvTabBarFirstViewController alloc] initWithNibName:nil bundle:nil];
    viewController1.title = @"First";
    
    viewController2 = [[SvTabBarFirstViewController alloc] initWithNibName:nil bundle:nil];
    viewController2.title = @"Second";
    
    self.tabBarController = [[[UITabBarController alloc] init] autorelease];
    self.tabBarController.delegate = self;
    self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, nil];

    [viewController1 release];
    [viewController2 release];
    
    self.window.rootViewController = self.tabBarController;
    [self.window makeKeyAndVisible];
    
    return YES;
}
复制代码

 

二、UITabBarItem

  UITabBar上面显示的每一个Tab都对应着一个ViewController,我们可以通过设置viewcontroller.tabBarItem属性来改变tabbar上对应的tab显示内容。否则系统将会根据viewController的title自动创建一个,该tabBarItem只显示文字,没有图像。当我们自己创建UITabBarItem的时候,我们可以显示的指定显示的图像和对应的文字描述。当然还可以通过setFinishedSelectedImage:withFinishedUnselectedImage:方法给选中状态和飞选中状态指定不同的图片。下面看个自己创建UITabBarItem的小例子:

UITabBarItem *item = [[UITabBarItem alloc] initWithTitle:@"Second" image:nil tag:2];
[item setFinishedSelectedImage:[UIImage imageNamed:@"second.png"] 
   withFinishedUnselectedImage:[UIImage imageNamed:@"first.png"]];
viewController2.tabBarItem = item;
[item release];

  此外UITabBarItem还有一个属性badgeValue,通过设置该属性可以在其右上角显示一个小的角标,通常用于提示用户有新的消息,使用很简单,后面有例子。

 

三、moreNavigationController

  UITabBar上最多可以显示5个Tab,当我们往UITabBarController中添加超过的viewController超过5个时候,最后一个一个就会自动变成,按照设置的viewControlles的顺序,显示前四个viewController的tabBarItem,后面的tabBarItem将不再显示。当点击more时候将会弹出一个标准的navigationViewController,里面放有其它未显示的的viewController,并且带有一个edit按钮,通过点击该按钮可以进入类似与ipod程序中设置tabBar的编辑界面。编辑界面中默认所有的viewController都是可以编辑的,我们可以通过设置UITabBarController的customizableViewControllers属性来指定viewControllers的一个子集,即只允许一部分viewController是可以放到tabBar中显示的。但是这块儿要注意一个问题就是每当UITabBarController的viewControllers属性发生变化的时候,customizableViewControllers就会自动设置成跟viewControllers一致,即默认的所有的viewController都是可以编辑的,如果我们要始终限制只是某一部分可编辑的话,记得在每次viewControlles发生改变的时候,重新设置一次customizableViewControllers。

  

四、UITabBarController的Rotation

  UITabBarController默认只支持竖屏,当设备方向放生变化时候,它会查询viewControllers中包含的所有ViewController,仅当所有的viewController都支持该方向时,UITabBarController才会发生旋转,否则默认的竖向。

  此处需要注意当UITabBarController支持旋转,而且发生旋转的时候,只有当前显示的viewController会接收到旋转的消息。

 

五、UITabBar

   UITabBar自己有一些方法是可以改变自身状态,但是对于UITabBarController自带的tabBar,我们不能直接去修改其状态。任何直接修改tabBar的操作将会抛出异常,下面看一个抛出异常的小例子:

复制代码
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.delegate = self;
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, viewController3, nil];
    
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
    
self.tabBarController.tabBar.selectedItem = nil;
复制代码

  上面代码的最后一行直接修改了tabBar的状态,运行程序回得到如下结果:

 

六、Change Selected Viewcontroller

  改变UITabBarController中当前显示的viewController,可以通过一下两种方法:

  1、selectedIndex属性

  通过该属性可以获得当前选中的viewController,设置该属性,可以显示viewControllers中对应的index的viewController。如果当前选中的是MoreViewController的话,该属性获取出来的值是NSNotFound,而且通过该属性也不能设置选中MoreViewController。设置index超出viewControllers的范围,将会被忽略。

  2、selectedViewController属性

  通过该属性可以获取到当前显示的viewController,通过设置该属性可以设置当前选中的viewController,同时更新selectedIndex。可以通过给该属性赋值

tabBarController.moreNavigationController可以选中moreViewController。

  3、viewControllers属性

  设置viewControllers属性也会影响当前选中的viewController,设置该属性时UITabBarController首先会清空所有旧的viewController,然后部署新的viewController,接着尝试重新选中上一次显示的viewController,如果该viewController已经不存在的话,会接着尝试选中index和selectedIndex相同的viewController,如果该index无效的话,则默认选中第一个viewController。

 

七、UITabBarControllerDelegate

  通过代理我们可以监测UITabBarController的当前选中viewController的变化,以及moreViewController中对编辑所有viewController的编辑。通过实现下面方法:

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController;

  该方法用于控制TabBarItem能不能选中,返回NO,将禁止用户点击某一个TabBarItem被选中。但是程序内部还是可以通过直接setSelectedIndex选中该TabBarItem。

  下面这三个方法主要用于监测对moreViewController中对view controller的edit操作

复制代码
- (void)tabBarController:(UITabBarController *)tabBarController willBeginCustomizingViewControllers:(NSArray *)viewControllers;

- (void)tabBarController:(UITabBarController *)tabBarController willEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed;

- (void)tabBarController:(UITabBarController *)tabBarController didEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed;
复制代码

  

七、附件UITabBarController测试程序源码

 

SvTabBarAppDelegate.h这个头文件,折叠后加进去,总是无法展开,望大家见谅!

 

复制代码
//
//  SvTabBarAppDelegate.h
//  SvTabBarControllerSample
//
//  Created by maple on 5/19/12.
//  Copyright (c) 2012 smileEvday. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface SvTabBarAppDelegate : UIResponder <UIApplicationDelegate, UITabBarControllerDelegate>

@property (strong, nonatomic) UIWindow *window;

@property (strong, nonatomic) UITabBarController *tabBarController;

@end
复制代码

 

复制代码
//
//  SvTabBarAppDelegate.m
//  SvTabBarControllerSample
//
//  Created by maple on 5/19/12.
//  Copyright (c) 2012 smileEvday. All rights reserved.
//

#import "SvTabBarAppDelegate.h"

#import "SvTabBarFirstViewController.h"
#import "SvTabBarSecondViewController.h"

@implementation SvTabBarAppDelegate

@synthesize window = _window;
@synthesize tabBarController = _tabBarController;

- (void)dealloc
{
    [_window release];
    [_tabBarController release];
    [super dealloc];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    SvTabBarFirstViewController *viewController1, *viewController2, *viewController3;
    SvTabBarFirstViewController *viewController4, *viewController5, *viewController6;
    
    // second kind tabbar controlle
    SvTabBarSecondViewController *viewController7;
    
    // init first tabbarviewcontroller
    viewController1 = [[SvTabBarFirstViewController alloc] initWithNibName:nil bundle:nil];
    viewController1.title = @"First";
    // here set text is in vain, because the vc's view is not load
    //viewController1.contentLbl.text = @"First Tab";
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn.frame = CGRectMake(0, 0, 150, 70);
    btn.center = CGPointMake(160, 120);
    btn.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
    [btn setTitle:@"Change to Third" forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(changToThirdTab) forControlEvents:UIControlEventTouchUpInside];
    [viewController1.view addSubview:btn];
    
    btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn.frame = CGRectMake(0, 0, 150, 70);
    btn.center = CGPointMake(160, 240);
    btn.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
    [btn setTitle:@"Change to MoreVC" forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(changToMoreTab) forControlEvents:UIControlEventTouchUpInside];
    [viewController1.view addSubview:btn];
    
    btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn.frame = CGRectMake(0, 0, 150, 70);
    btn.center = CGPointMake(160, 360);
    btn.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
    [btn setTitle:@"Set ViewController" forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(setTabBarViewController) forControlEvents:UIControlEventTouchUpInside];
    [viewController1.view addSubview:btn];
    
    viewController2 = [[SvTabBarFirstViewController alloc] initWithNibName:nil bundle:nil];
    viewController2.title = @"Second";
    btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn.frame = CGRectMake(0, 0, 150, 70);
    btn.center = CGPointMake(160, 120);
    btn.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
    [btn setTitle:@"Change to Fourth" forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(changToFourthTab) forControlEvents:UIControlEventTouchUpInside];
    [viewController2.view addSubview:btn];
    
    btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn.frame = CGRectMake(0, 0, 150, 70);
    btn.center = CGPointMake(160, 240);
    btn.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
    [btn setTitle:@"Set Badge" forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(setBadge) forControlEvents:UIControlEventTouchUpInside];
    [viewController2.view addSubview:btn];
    
    
    viewController3 = [[SvTabBarFirstViewController alloc] initWithNibName:nil bundle:nil];
    viewController3.title = @"Third";
    UITabBarItem *item = [[UITabBarItem alloc] initWithTitle:@"#3#" image:nil tag:2];
    [item setFinishedSelectedImage:[UIImage imageNamed:@"second.png"] 
       withFinishedUnselectedImage:[UIImage imageNamed:@"first.png"]];
    viewController3.tabBarItem = item;
    [item release];
    
    viewController4 = [[SvTabBarFirstViewController alloc] initWithNibName:nil bundle:nil];
    viewController4.title = @"Fourth";
    
    viewController5 = [[SvTabBarFirstViewController alloc] initWithNibName:nil bundle:nil];
    viewController5.title = @"Fifth";
    
    viewController6 = [[SvTabBarFirstViewController alloc] initWithNibName:nil bundle:nil];
    viewController6.title = @"Sixth";
    
    // only support portrait interface, so when you add this vc to tabBarcontroller, 
    // the tabbarcontroller will support portrait interface only
    viewController7 = [[SvTabBarSecondViewController alloc] initWithNibName:nil bundle:nil];
    
    self.tabBarController = [[[UITabBarController alloc] init] autorelease];
    self.tabBarController.delegate = self;
    self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, viewController3, 
                                             viewController4, viewController5, viewController6, viewController7, nil];
    self.tabBarController.customizableViewControllers = [NSArray arrayWithObjects:viewController1, viewController2, viewController3, 
                                                         viewController4, nil];
    
    [viewController1 release];
    [viewController2 release];
    [viewController3 release];
    [viewController4 release];
    [viewController5 release];
    [viewController6 release];
    [viewController7 release];
    
    self.window.rootViewController = self.tabBarController;
    [self.window makeKeyAndVisible];
    
    // Directly modifying a tab bar managed by a tab bar controller is not allowed.
//    self.tabBarController.tabBar.selectedItem = nil;
    
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

/*
// Optional UITabBarControllerDelegate method.
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
}
*/

/*
// Optional UITabBarControllerDelegate method.
- (void)tabBarController:(UITabBarController *)tabBarController didEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed
{
}
*/

#pragma mark -
#pragma mark Btn action

- (void)changToThirdTab
{
    [self.tabBarController setSelectedViewController:[self.tabBarController.viewControllers objectAtIndex:2]];
}

- (void)changToFourthTab
{
    [self.tabBarController setSelectedIndex:3];
}

// set tabbar viewcontrollers will lead customizableViewControllers set to default.(equal to viewcontrollers)
// so if you want to restrict customizableViewControllers, you should reset it when viewcontrollers changed
- (void)setTabBarViewController
{
    self.tabBarController.viewControllers = self.tabBarController.viewControllers;
}

// you can just select more tab by set selectedViewController, set selectedIndex is in vain
- (void)changToMoreTab
{
    [self.tabBarController setSelectedViewController:self.tabBarController.moreNavigationController];
    
    // when set more tab selected, the selectedindex will be NSNotFound
    NSLog(@"%d", self.tabBarController.selectedIndex);
}

- (void)setBadge
{
    self.tabBarController.selectedViewController.tabBarItem.badgeValue = @"2";
}

#pragma mark-
#pragma mark UITabBarcontrollerDelegate

- (void)tabBarController:(UITabBarController *)tabBarController willBeginCustomizingViewControllers:(NSArray *)viewControllers
{
    NSLog(@"willBeginCustomizingViewControllers: %@", viewControllers);
}

- (void)tabBarController:(UITabBarController *)tabBarController willEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed
{
    NSLog(@"viewcontrollers: %@, ischanged: %d", viewControllers, changed);
}


- (void)tabBarController:(UITabBarController *)tabBarController didEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed
{
    NSLog(@"didEndCustomizingViewController!");
    NSLog(@"didEndCustomizingViewController: %@, ischanged: %d", viewControllers, changed);
}

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
{
    if ([tabBarController.viewControllers indexOfObject:viewController] != 2) {
        return YES;
    }
    return NO;
}

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
    NSLog(@"didSelectViewController!");
}

@end
复制代码
复制代码
//
//  SvTabBarFirstViewController.h
//  SvTabBarControllerSample
//
//  Created by maple on 5/19/12.
//  Copyright (c) 2012 smileEvday. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface SvTabBarFirstViewController : UIViewController 


@end
复制代码
复制代码
//
//  SvTabBarFirstViewController.m
//  SvTabBarControllerSample
//
//  Created by maple on 5/19/12.
//  Copyright (c) 2012 smileEvday. All rights reserved.
//

#import "SvTabBarFirstViewController.h"

@interface SvTabBarFirstViewController ()

@end

@implementation SvTabBarFirstViewController


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
        self.tabBarItem.image = [UIImage imageNamed:@"first"];
    }
    return self;
}
                            
- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.view.backgroundColor = [UIColor whiteColor];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.

}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
    } else {
        return YES;
    }
}

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    NSLog(@"%@ rotate!", self.title);
}

- (NSString*)description
{
    return [NSString stringWithFormat:@"title: %@", self.title];
}

@end
复制代码
复制代码
//
//  SvTabBarSecondViewController.h
//  SvTabBarControllerSample
//
//  Created by maple on 5/19/12.
//  Copyright (c) 2012 smileEvday. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface SvTabBarSecondViewController : UIViewController

@end
复制代码
复制代码
//
//  SvTabBarSecondViewController.m
//  SvTabBarControllerSample
//
//  Created by maple on 5/19/12.
//  Copyright (c) 2012 smileEvday. All rights reserved.
//

#import "SvTabBarSecondViewController.h"

@interface SvTabBarSecondViewController ()

@end

@implementation SvTabBarSecondViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.tabBarItem.image = [UIImage imageNamed:@"second"];
    }
    return self;
}
                            
- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.view.backgroundColor = [UIColor greenColor];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    //return (interfaceOrientation == UIInterfaceOrientationPortrait);
    return YES;
}

@end
复制代码
Windows Pychram部署Unet++过程 windows系统 在pycharm平台上配置并跑通Unet网络 这里我用的是B站课程里的资源《唐宇迪Unet图像分割语义分割实战》 阅读详情

相关推荐

Fluent实战——残差震荡分析与收敛优化策略

本文深入探讨了Fluent仿真中残差震荡的成因与优化策略。残差震荡是流场物理或数值问题的关键信号,文章系统分析了网格质量、边界条件、物理模型非定常性及求解设置四大主因,并提供了库朗数与松弛因子的调参心法,以及针对超音速流、共轭传热等典型场景的实战优化方案,旨在帮助用户有效提升计算收敛性与结果可靠性。

w1x2y3的博客 313

UITabBarController详解

UITabBarController使用详解   UITabBarController是IOS中很常用的一个viewController,例如系统的闹钟程序,ipod程序等。UITabBarController通常作为整个程序的rootViewController,而且不能添加到别的container viewController中。   首先我们看一下它的view层级图: 一、手动创建...

weixin_34257076的博客 321

stm32开发3D打印机(一)——介绍(已完成)

如何运用stm32开发3D打印机

Nico_jion的博客 1万+

iphone开发之解决viewWillAppear失效

你可曾遇到过viewWillAppear没有被调用到的情况 产生原因是用了UINavigationController.   将UINavigationController的view作为subview添加到了其他viewController的view中。  或者把UINavigationController添加到UITabbarController中了。  此时,Navigatio

晓月的专栏 967

Xcelium XRUN实用指南:从入门到高效仿真

本文是Xcelium XRUN仿真工具的实用指南,从基础入门到高效应用全面解析。XRUN作为Cadence Xcelium的统一命令行入口,能自动化编译、精细和仿真流程,大幅提升数字芯片与FPGA验证效率。文章详细介绍了最简命令、波形调试、增量编译、多核并行仿真等核心功能,并提供了管理复杂项目、性能调优与深度调试的进阶技巧,帮助工程师快速上手并精通这一高效仿真工具。

weixin_29238147的博客 739

Android 13.0 设置默认屏幕亮度百分比

在13.0的系统ROM产品开发中,在一些产品开发中,对于设置默认屏幕亮度和屏幕亮度百分比的功能,在开发中也是常见的功能,在10.0的平台设置可能有一些不同,一般的都是在SettingProvider中设置就可以了 在11.0以后的系统中设置默认屏幕亮度的方法就不同了,接下来具体分析功能的实现

安卓兼职framework和app工程师的博客 1560

IOS开发之——UITabBarController空项目(61)

一 概述 跟UINavigationController类似,UITabBarController也可以轻松地管理多个控制器,轻松完成控制器之间的切换,典型的例子就是QQ、微信等应用 二 UITabBarController的简单实用 2.1 UITabBarController的使用步骤 初始化UITabBarController 设置UIWindow的rootViewController为UITabBarController 根据具体情况,通过addChildView

我的博客 388

YOLOv11全网首发:注意力独家魔改 | 具有切片操作的SimAM注意力,魔改SimAM助力小目标检测

1)直接作为注意力使用,效果秒杀SimAM;2)高效和卷积结合,代替原始网络的卷积操作;

①答疑群聊服务;②YOLO大模型知识问答系统;③计算机视觉论文生成智能体; 1572

iOS 【错误:'Changing the delegate of a tab bar managed by a tab bar controller is not allowed.'】

错误:'Changing the delegate of a tab bar managed by a tab bar controller is not allowed.'   意为不允许修tabBar的delegate属性 产生原因:设置代理的这句代码写在了 为 tabBarController 的 tabBar属性 赋值 之后 看一下错误产生的代码:(共三行正确代码,其余的是个人理解

CoderZYWang 4105

YOLO26训练自己的数据集,从代码下载到实例测试 (含YOLO26网络结构图)

在Windows10上配置CUDA环境教程2026年1月14日,YOLO26是最新发布的计算机视觉模型。支持多种任务,包括目标检测、实例分割、图像分类、姿态估计、有向目标检测以及物体跟踪等。以上就是YOLO26训练自己数据集的全部过程啦,欢迎大家在评论区交流~

Limiiiing的博客 6494

基于STM32L4XX、HAL库的 TMC2660C-PA 驱动程序设计

/ 默认灵敏度和电流。// 20/31最大电流。

zhusl6688的博客 384

UITabBarController使用

UITabBarController是IOS总常用的ViewController之一,下面简单介绍一下其使用: 1.UITabBarController主要用于管理多个控制器 如上图tabBar的每一项对应一个viewController 2.根据提供的文档,UITabBarController通常作为整个程序的rootViewController,一般不建议添加到其他的 viewC

showmyself 523

2024年游戏策划最新面试题及答案

1. **游戏策划**:负责游戏设计和开发的创意和技术过程。2. **主要职责**:设计游戏玩法、故事、角色、世界等。4. **游戏机制**:定义玩家如何与游戏世界互动的规则。13. **引人入胜的角色**:深入的背景故事、个性特征。3. **游戏平衡**:确保游戏公平、有趣且具有挑战性。7. **RPG特点**:角色发展、故事驱动、玩家选择。12. **关卡设计技巧**:挑战性、流动性、视觉引导。11. **游戏关卡设计**:创建游戏世界的不同阶段。5. **游戏循环**:玩家在游戏中重复的行为模式。

guo162308的博客 2320

UITabBarController的使用总结

做了这么长时间的ios开发了,最基本的UITabBarController和UINavigationController都用了好长时间了,总是改现成的代码,或者各种自定义控件的修改,用的都有些混乱了,呵呵。还是自己做个demo再复习一下吧,记录下来以备后续翻查。 一、UITabBarController和UINavigationController的联合使用。 这种方法最常见,好像一般有tab

abby_lin的专栏 1万+

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

UITabBarController的使用

一、简单介绍 UITabBarController和UINavigationController类似,UITabBarController也可以轻松地管理多个控制器,轻松完成控制器之间的切换,典型的例子就是QQ、微信等应⽤。   二、UITabBarController的使用 (1)初始化UITabBarController (2)设置UIWindow的rootViewControlle

qq_18740277的专栏 306

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

UITabBarController

前言 UITabBarController: 分栏视图控制器,在创建时,需要一次性的将所有 viewController 或 navigationController 添加到 UITabBarController 的 viewControllers 属性中。 UITabBarController 一次性添加了很多个视图控制器,但是在程序的运行的时候,并不是一次性将所有视图控制器对象进行...

diaochuanzhi7826的博客 263

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

理解UITabBarController

今天,我们来剖析一下UITabBarController。首先,看一下one app的UITabBarController的效果 红色矩形框选的就是UITabBarController的tabBar控件。 接下来,我们先学会如何使用UITabBarController。 基本使用步骤是: 1.创建子视图viewController 2.设置子视图viewControlle

静水流深 610

IOS之UITabBarController

在学习IOS开发过程中,针对于UITabBarController的使用也不少出现,UITabBarController和UINavigationController类似,UITabBarController也可以轻松地管理多个控制器,轻松完成控制器之间的切换   使用步骤: 1初始化UITabBarController 2设置UIWindow的rootViewController为

无名 715

关于UITabBarController的使用

UITabBarController简单介绍: 1.UITabBarController这种控件,主要用于管理多个控制器,例如微信,QQ等App的最下面的导航栏。现下较为常用的iOS控件之一。 2.UITabBarController的使用     初始化UITabBarController     设置UIWindow的rootViewController为UITabBarC

Darling_qd的专栏 671
上一篇: 自己写的通讯录(按拼音排序、分组)
下一篇: iOS学习之Map,定位,标记位置的使用
临红尘
博客等级 码龄19年 10粉丝 0原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值