webView에서 마우스액션처럼 뒤로 앞으로 구현!!
- (void)viewDidLoad {
[super viewDidLoad];
//Swipe Left
UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeLeftAction:)];
swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
//swipeLeft.delegate = self;
[webView addGestureRecognizer:swipeLeft];
//Swipe Right
UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRightAction:)];
swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
//swipeRight.delegate = self;
[webView addGestureRecognizer:swipeRight];
webView.delegate = self;
NSString *homeUrl = @http://www.naver.com;
NSURL *url = [NSURL URLWithString:homeUrl];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES;
}
- (void)swipeRightAction:(id)ignored
{
[webView goForward];
}
- (void)swipeLeftAction:(id)ignored
{
[webView goBack];
}
'프로그래밍 > iOS' 카테고리의 다른 글
아이폰 앱 76개 소스코드, 강좌, 개발 팁 링크모음 (0) | 2012.06.06 |
---|---|
FaceBook Graph Api 설명 (0) | 2012.06.02 |
.a 라이브러리 파일 SVN commit 방법 (0) | 2012.05.24 |
Xcode 에서 라이브러리 파일(*.a)가 ignore 처리되어 SVN에 등록되지 않을때 해결방법 (0) | 2012.05.24 |
메모리 관리 규칙 (0) | 2012.05.19 |