您的位置:首页 > 移动开发 > IOS开发

IOS 图片轮播和开始的指导界面

2012-09-29 16:31 337 查看
开始的引导界面 借鉴了 code4app.com 上的 我更改了他的实现方式 用到他的 image分割

图片轮播是我以前写的 轮播我设置了计时器 可自动下一张

现在分享出来







这是引导界面的用法

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[LKViewController alloc] initWithNibName:@"LKViewController" bundle:nil];

NSMutableArray* dataArray = [NSMutableArray array];
for (int i=1; i<=5; i++) {
//加载图片的完整路劲
[dataArray addObject:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"welcome-%d",i] ofType:@"jpg"]];
}
//怎么判断是第一次进入 可以有 判断文件 判断字段 等等方法
LKWelcomeView* welcome = [[LKWelcomeView alloc]initWithFrame:CGRectMake(0, 20, self.window.frame.size.width, self.window.frame.size.height-20) andPathArray:dataArray];

[self.window addSubview:welcome];
welcome.endEvent = ^(){
//当要进入主程序
[self.window insertSubview:self.viewController.view atIndex:0];
};

[self.window makeKeyAndVisible];
return YES;
}


这是轮播的用法都很简单

- (void)viewDidLoad
{
NSMutableArray* pagearray = [NSMutableArray arrayWithCapacity:5];
for (int i = 1 ; i <= 5; i++) {
[pagearray addObject:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"page_%d",i] ofType:@"jpg"]];
}

LKPageView* page = [[LKPageView alloc]initWithPathStringArray:pagearray andFrame:CGRectMake(0, 50, 320, 200)];
[self.view addSubview:page];
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}


项目的下载地址 http://download.csdn.net/detail/li6185377/4608868

自己也没分了 所以设了1分

努力每个月都写一篇博客。。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: