7秒丶记忆吧 关注:2贴子:59
  • 5回复贴,共1

链接的跳转

只看楼主收藏回复

两种跳转方式:
1.APP内部的跳转
2.APP外部的跳转


IP属地:山东1楼2015-10-29 11:44回复
    1.内部的跳转
    if ([jumpType isEqualToString:@"in"]) {
    WebViewController *webVC = [[WebViewController alloc]init];
    webVC.webUrl = infoUrl;
    [self.navigationController pushViewController:webVC animated:YES];
    }
    2.外部的跳转
    if ([jumpType isEqualToString:@"out"]) {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:infoUrl]];
    }


    IP属地:山东2楼2015-10-29 11:45
    回复
      2025-07-13 21:14:23
      广告
      #import "WebViewController.h"
      #import "UConfig.h"
      #import "ShareContent.h" //呼应的内容
      #import "WXAccessTokenDataSource.h"
      #import "Util.h"
      #import "ContactManager.h"
      #import "CallerManager.h"
      #import "UIUtil.h"
      #import "TimeBiViewController.h"//呼应的时长和应币
      #import "YingBiFAQViewController.h"
      //webview交互接口
      #define GameStatusBack @"gameStatusCallback"
      #define ClientCallBack @"clientCallback"
      #define WXCIRCLE @"shareToWXCricle"
      #define WXFRIEND @"shareToWXFriend"
      #define QQSHARE @"shareToQQ"
      #define SINASHARE @"shareToSina"
      #define TENCENTWEIBO @"shareToTencentWeibo"
      #define CONTACTSHARE @"shareToContact"
      #define OpenAPP @"openApp"
      #define JumpOrDownLoadApk @"jumpOrDownloadApk"
      #define CheckAppStatus @"checkAppStatus"
      #define CALL @"call"
      #define KReadContactData @"readContactData"//读取联系人
      #define KOpenAppPage @"openAppPage"//打开指定的页面
      #define UNDOWNLOAD @"UNDOWNLOAD" //未下载(下载)
      #define DOWNLOADING @"DOWNLOADING" //下载中(下载中)
      #define DOWNLOADED @"DOWNLOADED" //已下载(安装)
      #define INSTALLED @"INSTALLED" //已安装(打开)
      #define YINGBI @"huying:com.ucaller.YingBiOrDurationStore?isFeeStore=false"
      #define TIME @"huying:com.ucaller.YingBiOrDurationStore?isFeeStore=true"
      /*
      *目前iOS端只能检测未下载和已安装
      */
      @implementation WebBackObject
      @synthesize isBack;
      @synthesize cmd;
      @synthesize paraMarr;
      @synthesize other;
      -(id)init
      {
      self = [super init];
      if (self) {
      isBack = NO;
      paraMarr = [[NSMutableArray alloc]init];
      }
      return self;
      }
      @end
      @interface WebViewController ()
      {
      UIWebView *huyingWebView;
      WebBackObject *backObj;
      HTTPManager *addStatHttp;//统计接口
      BOOL backLock;//回调json安全锁
      }
      @end
      @implementation WebViewController
      @synthesize webUrl;
      -(id)init
      {
      if (self = [super init]) {
      addStatHttp = [[HTTPManager alloc]init];
      addStatHttp.delegate = self;
      backLock = NO;
      }
      return self;
      }
      - (void)viewDidLoad {
      [super viewDidLoad];
      self.view.backgroundColor = PAGE_BACKGROUND_COLOR;
      //返回按钮
      [self addNaviSubView:[Util getNaviBackBtn:self]];
      huyingWebView = [[UIWebView alloc]init];
      huyingWebView.frame = CGRectMake(0, LocationY, self.view.bounds.size.width, self.view.bounds.size.height-LocationY-LocationYWithoutNavi);
      [huyingWebView setBackgroundColor:[UIColor clearColor]];
      [(UIScrollView *)[[huyingWebView subviews] objectAtIndex:0] setBounces:NO];
      //[absWebView.scrollView setScrollEnabled:YES];
      [self.view addSubview:huyingWebView];
      //添加右滑返回
      [UIUtil addBackGesture:self andSel:@selector(rightReturnLastPage:)];
      }
      -(void)viewWillAppear:(BOOL)animated
      {
      [super viewWillAppear:animated];
      [self pageRefrash];
      }
      - (void)didReceiveMemoryWarning {
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
      }
      -(void)dealloc
      {
      backLock = NO;
      [[NSNotificationCenter defaultCenter] removeObserver:self name:
      KShareSuccess object:nil];
      [[NSNotificationCenter defaultCenter] removeObserver:self name:
      KShareFail object:nil];
      [[NSNotificationCenter defaultCenter] removeObserver:self name:KShareSmsSuccess object:nil];
      [[NSNotificationCenter defaultCenter] removeObserver:self name:
      KShareSmsFail object:nil];
      }
      -(void)rightReturnLastPage:(UISwipeGestureRecognizer * )swipeGesture{
      if ([swipeGesture locationInView:self.view].x < 100) {
      [self.navigationController popViewControllerAnimated:YES];
      [self returnLastPage];
      }
      }
      -(void)returnLastPage
      {
      [self clearWebView];
      backLock =NO;
      huyingWebView = nil;
      [self.view endEditing:YES];
      [self.navigationController popViewControllerAnimated:YES];
      }
      //清理缓存
      -(void)clearWebView
      {
      NSURLCache * cache = [NSURLCache sharedURLCache];
      [cache removeAllCachedResponses];
      [cache setDiskCapacity:0];
      [cache setMemoryCapacity:0];
      }


      IP属地:山东5楼2015-10-29 11:59
      收起回复