资源说明:可以切换视图,随机改变颜色。拷贝SunSegmentedControl.h和SunSegmentedControl.m 在ViewController.m文件中实现 SunSegmentedControl *av=[[SunSegmentedControl alloc]initWithFrame:CGRectMake(0, 200, self.view.frame.size.width, 44)titles:@[@"",@"",@"",@"",@"" ] backblock:^(NSInteger index){
NSLog(@"%@",av);}];
self.navigationItem.titleView=av;在AppDelegate.m 创建一个导航栏 ViewController *nc=[[ViewController alloc]init];
UINavigationController *vc=[[UINavigationController alloc]initWithRootViewController:nc];
self.window.rootViewController=vc;
就可以调用这里的方法了
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。