CustomTabbar *tabbar = [[CustomTabbar alloc]init]; //KVC,更换系统的tabbar为自定义tabbar tabbar.tabbarDelegate = self; [self setValue:tabbar forKeyPath:@"tabBar"];
此处keyPath:@"tabBar",为系统的tabBar声明的私有的成员变量名
CustomTabbar *tabbar = [[CustomTabbar alloc]init]; //KVC,更换系统的tabbar为自定义tabbar tabbar.tabbarDelegate = self; [self setValue:tabbar forKeyPath:@"tabBar"];
此处keyPath:@"tabBar",为系统的tabBar声明的私有的成员变量名