#import "XLSlideSwitch.h"
#import "RDViewController.h"
#import "TJViewController.h"
#import "YLViewController.h"
#import "SPViewController.h"
#import "DYViewController.h"
#import "SJViewController.h"
@interface oneViewController ()<XLSlideSwitchDelegate>{
UIView * Someview; //是点击加号的按钮
}
@property(nonatomic,strong)XLSlideSwitch * GDview; // 滚动视图
@end
@implementation oneViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.title = @"首页";
// self.navigationController.navigationBar.barTintColor = [UIColor whiteColor];
//分段控制器
//创建一个数组
NSArray * arr =@[@"推荐",@"热点",@"娱乐",@"视频",@"订阅",@"事件"];
//数组
NSArray * array =@[@"RDViewController",@"TJViewController",@"YLViewController",@"SPViewController",@"DYViewController",@"SJViewController"];
//可变数组
NSMutableArray * viewcontroller = [[NSMutableArray alloc] init];
//创建一个for循环
for(int i = 0; i<arr.count; i++){
//字符串控制器
UIViewController * VC = [[NSClassFromString(array[i])alloc] init];
//添加
[viewcontroller addObject:VC];
}
//滚动视图
_GDview = [[XLSlideSwitch alloc] initWithFrame:CGRectMake(0, 64, self.view.bounds.size.width, self.view.bounds.size.height - 64) Titles:arr viewControllers:viewcontroller];
//代理
_GDview.delegate=self;
//颜色
_GDview.itemNormalColor=[UIColor darkGrayColor];
_GDview.itemSelectedColor = self.navigationController.navigationBar.tintColor;
//设置控件的距离
_GDview.customTitleSpacing = 30;
[_GDview showInViewController:self];
Someview = [[UIView alloc] initWithFrame:CGRectMake(self.view.bounds.size.width - 150, 104, 140, 200)]; Someview.backgroundColor = [UIColor orangeColor];
for (int i = 0 ; i < 1; i ++) { [self.view addSubview:Someview];
Someview.backgroundColor = [UIColor orangeColor];
for (int i = 0 ; i < 1; i ++) {
[self.view addSubview:Someview];
Someview.hidden = YES;
}
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
分段
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- UIView+SGFrame.h #import @interface UIView (SGFrame) @pro...