Skip to content

Instantly share code, notes, and snippets.

@letitride
Last active December 24, 2015 01:19
Show Gist options
  • Save letitride/6723351 to your computer and use it in GitHub Desktop.
Save letitride/6723351 to your computer and use it in GitHub Desktop.
iphoneアプリ WebViewのcookie共有テスト
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIWebView *webView;
@property (weak, nonatomic) IBOutlet UILabel *topLabel;
- (IBAction)startView:(UIButton *)sender;
- (IBAction)endView:(UIButton *)sender;
@property (weak, nonatomic) IBOutlet UIWebView *webView_A;
- (IBAction)startView_A:(UIButton *)sender;
@end
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.webView.hidden = YES;
self.webView_A.hidden = YES;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)startView:(UIButton *)sender {
self.topLabel.hidden = YES;
self.webView_A.hidden = YES;
self.webView.hidden = NO;
NSURLRequest* req = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://example.jp/w.php"]];
[self.webView loadRequest:req];
}
- (IBAction)startView_A:(UIButton *)sender {
self.topLabel.hidden = YES;
self.webView_A.hidden = NO;
self.webView.hidden = YES;
NSURLRequest* req = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://example.jp/x.php"]];
[self.webView_A loadRequest:req];
}
- (IBAction)endView:(UIButton *)sender {
self.topLabel.hidden = NO;
self.webView.hidden = YES;
self.webView_A.hidden = YES;
self.webView.delegate = nil;
self.webView_A.delegate = nil;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment