forked from chenyufeng1991/iOS-Oncenote
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
294 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
Oncenote/Assets.xcassets/guidepage0.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "guidepage01.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
Oncenote/Assets.xcassets/guidepage1.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "guidepage02.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
Oncenote/Assets.xcassets/guidepage2.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "guidepage03.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
Oncenote/Assets.xcassets/guidepage3.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "guidepage04.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// GuidePageViewController.h | ||
// Oncenote | ||
// | ||
// Created by chenyufeng on 15/11/22. | ||
// Copyright © 2015年 chenyufengweb. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface GuidePageViewController : UIViewController | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
|
||
// | ||
// GuidePageViewController.m | ||
// Oncenote | ||
// | ||
// Created by chenyufeng on 15/11/22. | ||
// Copyright © 2015年 chenyufengweb. All rights reserved. | ||
// | ||
|
||
#import "GuidePageViewController.h" | ||
#import "AllUtils.h" | ||
|
||
#define UISCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width) | ||
|
||
@interface GuidePageViewController ()<UIScrollViewDelegate,UIPageViewControllerDelegate> | ||
|
||
@property (weak, nonatomic) IBOutlet UIScrollView *guidepageScrollView; | ||
|
||
@property(nonatomic,strong)UIPageControl *pageControl; | ||
|
||
|
||
@end | ||
|
||
@implementation GuidePageViewController | ||
|
||
- (void)viewDidLoad { | ||
[super viewDidLoad]; | ||
|
||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; | ||
[userDefaults setObject:@"exist" forKey:@"guidepage"]; | ||
|
||
self.pageControl = [[UIPageControl alloc] initWithFrame:CGRectMake([[UIScreen mainScreen] bounds].size.width / 2 - 50, [[UIScreen mainScreen] bounds].size.height - 50, 100, 20)]; | ||
self.pageControl.numberOfPages = 5; | ||
[self.view addSubview:self.pageControl]; | ||
|
||
[self setGuidePageScrollViewFrame]; | ||
} | ||
|
||
#pragma mark - 设置控件的位置大小 | ||
- (void)setGuidePageScrollViewFrame{ | ||
|
||
self.guidepageScrollView.contentSize = CGSizeMake([[UIScreen mainScreen] bounds].size.width * 5, [[UIScreen mainScreen] bounds].size.height); | ||
[self.guidepageScrollView setUserInteractionEnabled:true]; | ||
[self.guidepageScrollView setScrollEnabled:true]; | ||
[self.guidepageScrollView setPagingEnabled:true]; | ||
[self.guidepageScrollView setShowsHorizontalScrollIndicator:false]; | ||
[self.guidepageScrollView setShowsVerticalScrollIndicator:false]; | ||
[self.guidepageScrollView setBounces:false]; | ||
|
||
[self setGuidePageImageFrame]; | ||
|
||
} | ||
|
||
- (void)setGuidePageImageFrame{ | ||
|
||
for (int i = 0; i < 4; i++) { | ||
|
||
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake([[UIScreen mainScreen] bounds].size.width * i, 0, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)]; | ||
|
||
[imageView setUserInteractionEnabled:true]; | ||
|
||
[imageView setImage:[UIImage imageNamed:[NSString stringWithFormat:@"guidepage%d",i]]]; | ||
|
||
[self.guidepageScrollView addSubview:imageView ]; | ||
|
||
|
||
} | ||
|
||
|
||
UIView *view = [[UIView alloc] initWithFrame:CGRectMake([[UIScreen mainScreen] bounds].size.width * 4, 0, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)]; | ||
[view setUserInteractionEnabled:true]; | ||
[view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"guidepage0.png"]]]; | ||
|
||
|
||
UIButton *loginButton = [[UIButton alloc] initWithFrame:CGRectMake((UISCREEN_WIDTH - 200) / 3, 400, 100, 30)]; | ||
[loginButton setTitle:@"登录" forState:UIControlStateNormal]; | ||
[loginButton.layer setBorderColor:[UIColor whiteColor].CGColor]; | ||
[loginButton.layer setBorderWidth:0.5]; | ||
[loginButton.layer setMasksToBounds:true]; | ||
[loginButton addTarget:self action:@selector(loginButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; | ||
|
||
UIButton *registerButton = [[UIButton alloc] initWithFrame:CGRectMake((UISCREEN_WIDTH - 200) / 3 + (UISCREEN_WIDTH - 200) / 3 + 100, 400, 100, 30)]; | ||
[registerButton setTitle:@"注册" forState:UIControlStateNormal]; | ||
[registerButton.layer setBorderColor:[UIColor whiteColor].CGColor]; | ||
[registerButton.layer setBorderWidth:0.5]; | ||
[registerButton.layer setMasksToBounds:true]; | ||
[registerButton addTarget:self action:@selector(registerButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; | ||
|
||
[view addSubview:loginButton]; | ||
[view addSubview:registerButton]; | ||
|
||
[self.guidepageScrollView addSubview:view]; | ||
|
||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
#pragma mark - UIScrollViewDelegate | ||
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{ | ||
|
||
CGFloat offsetWidth = self.guidepageScrollView.contentOffset.x; | ||
int pageNum = offsetWidth / [[UIScreen mainScreen] bounds].size.width; | ||
self.pageControl.currentPage = pageNum; | ||
|
||
|
||
|
||
} | ||
|
||
#pragma mark - 所有按钮的点击事件 | ||
- (void)loginButtonPressed:(id)sender{ | ||
|
||
[AllUtils jumpToViewController:@"LoginViewController" contextViewController:self handler:nil]; | ||
|
||
} | ||
|
||
- (void)registerButtonPressed:(id)sender{ | ||
|
||
[AllUtils jumpToViewController:@"RegisterViewController" contextViewController:self handler:nil]; | ||
} | ||
|
||
|
||
@end | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters