-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstafriendsMoreViewController.m
executable file
·94 lines (79 loc) · 2.97 KB
/
InstafriendsMoreViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//
// InstafriendsMoreViewController.m
// instafriends
//
// Created by Daniel Camargo on 10/08/12.
// Copyright (c) 2012 Daniel Camargo. All rights reserved.
//
#import "InstafriendsMoreViewController.h"
#import "InstafriendsConstants.h"
#import "InstafriendsNormalButtonSetup.h"
@interface InstafriendsMoreViewController ()
@property (strong, nonatomic) IBOutlet UIButton *buttonRate;
@property (strong, nonatomic) IBOutlet UINavigationBar *navBar;
@property (strong, nonatomic) IBOutlet UIWebView *helpWebView;
@end
@implementation InstafriendsMoreViewController
@synthesize buttonRate = _buttonRate;
@synthesize navBar = _navBar;
@synthesize helpWebView = _helpWebView;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (IBAction)rateApp:(id)sender {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:INSTAFRIENDS_RATE_URL]];
}
- (void)close
{
[self dismissModalViewControllerAnimated:YES];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
}
- (void)webViewDidStartLoad:(UIWebView *)webView{
//[self.activityIndicator startAnimating];
}
- (void)viewDidLoad
{
[super viewDidLoad];
[InstafriendsNormalButtonSetup setupButton:self.buttonRate];
self.helpWebView.delegate = self;
NSString *urlAddress = @"http://inst.me/app/help.html";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil];
[NSURLCache setSharedURLCache:sharedCache];
sharedCache = nil;
NSHTTPCookie *cookie;
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (cookie in [storage cookies]) {
[storage deleteCookie:cookie];
}
[[NSUserDefaults standardUserDefaults] synchronize];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10.0];
[self.helpWebView loadRequest:requestObj];
UIButton *closeButton = [UIButton buttonWithType: UIButtonTypeCustom];
[closeButton setImage: [UIImage imageNamed: @"close.png"] forState: UIControlStateNormal];
[closeButton addTarget: self action: @selector(close) forControlEvents: UIControlEventTouchUpInside];
[closeButton setFrame: CGRectMake(0, 0, 32, 32)];
UINavigationItem *item = [[UINavigationItem alloc] initWithTitle:@"More about"];
item.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView: closeButton];;
item.hidesBackButton = YES;
[self.navBar pushNavigationItem:item animated:NO];
}
- (void)viewDidUnload
{
[self setHelpWebView:nil];
[self setButtonRate:nil];
[self setNavBar:nil];
[super viewDidUnload];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end