界面的切换
#先给大家看看图
废话不多,直接代码
#import "Allservices.h"
#import "HomeService.h"
#import "HealthService.h"
#import "WatchService.h"
#define KScreenWidth [ UIScreen mainScreen ].bounds.size.width
@interface Allservices () <UIScrollViewDelegate>
//滚动scrollview
@property ( strong , nonatomic ) UIScrollView * mainScrollView ;
//控制器
@property ( strong , nonatomic ) HomeService * Home ;
@property ( strong , nonatomic ) HealthService * Health ;
@property ( strong , nonatomic ) WatchService * Watch ;
//按钮容器视图
@property ( strong , nonatomic ) UIView * btnContainerView ;
//滚动条
@property ( strong , nonatomic ) UILabel * sliderLabel ;
//按钮数组
@property ( strong , nonatomic ) NSMutableArray * btnsArray ;
//首先你得创建三个类,然后实例化对象出来
-(HomeService *) Home
{
if ( !_Home )
{
_Home = [[HomeService alloc] init] ;
}
return _Home ;
}
-(HealthService *) Health
{
if ( !_Health )
{
_Health = [[HealthService alloc] init];
}
return _Health ;
}
-(WatchService *) Watch
{
if ( !_Watch )
{
_Watch = [[WatchService alloc] init];
}
return _Watch ;
}
//自己定义的方法 初学者看到不要慌 只要在viewDidLoad中加载就好了
//当初我查资料的时候看到这种也很慌
-(void) setMainScrollView
{
//很明显,实例化UIScrollView对象并设置大小
_mainScrollView