Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5986761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:43:05+00:00 2026-05-22T22:43:05+00:00

I have a webview displayed in a scrollview and flip view and need to

  • 0

I have a webview displayed in a scrollview and flip view and need to find a way to open links when clicked in safari (not in the app)!

I would appriciate any help as im stuck for hours in this!

ArticleScrollVC.h

//  ArticleScrollVC.h




#import <UIKit/UIKit.h>
#import "PagedScrollview.h"
#import "OMPageControl.h"

#define VIEW_FRONT_TAG 98765
#define VIEW_DESCR_TAG 98764

@interface ArticleScrollVC : UIViewController <PagedScrollDelegate>{

    NSArray *articles;
    NSMutableArray *pages;
    IBOutlet PagedScrollView *scrollView;
    IBOutlet OMPageControl *pageControl;
    IBOutlet UIImageView *pageControlBG;
    IBOutlet UIImageView *imageBG;
    int currentPage;
}

@property (nonatomic,retain) NSArray *articles;
@property int currentPage;

- (void)resize;
- (void)changeViewMode;

+ (BOOL) showDescription;

- (IBAction) pageControlDidChange;

@end

// ArticleScrollVC.m

//  ArticleScrollVC.m


#import "ArticleScrollVC.h"
#import "AsyncImageView.h"
#import "TabListViewController.h"
#import "ArticlePageVC.h"


#define PREFIX_TAG 666666

@implementation ArticleScrollVC

static BOOL showDescription = NO;

@synthesize articles;
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
    [scrollView setScrollDelegate:self];
    [scrollView setCurrentPage:currentPage];
    pageControl.numberOfPages = 0;
    [pageControl setImageNormal:[UIImage imageNamed:@"pageControlNormal.png"]];
    [pageControl setImageCurrent:[UIImage imageNamed:@"pageControlCurrent.png"]];
}

- (int) numberOfPages{
    pageControl.numberOfPages = [articles count];
    if (pageControl.currentPage==0) {
        [pageControl setCurrentPage:1];
        [pageControl setCurrentPage:0];
    }
    //pages = [[NSMutableArray alloc] initWithCapacity:10];
    return [articles count];
}



- (UIView*) viewForPage:(int)page{
    UIDevice *dev = [UIDevice currentDevice];
    NSString *deviceModel = dev.model;
    ArticlePageVC *pageVC;

    if([deviceModel isEqual:@"iPad"] || [deviceModel isEqual:@"iPad Simulator"]){
        pageVC = [[[ArticlePageVC alloc] initWithNibName:@"ArticlePageIpad" bundle:nil] autorelease];
    }else {
        pageVC = [[[ArticlePageVC alloc] initWithNibName:@"ArticlePageVC" bundle:nil] autorelease];
    }

    pageVC.article = (ListItem *)[articles objectAtIndex:page];
    pageVC.view.frame = scrollView.frame;
    CGRect frame = scrollView.frame;
    [pageVC resize:frame];
    pageVC.view.tag = PREFIX_TAG+page;
    return pageVC.view;
}

- (IBAction) pageControlDidChange{
    [scrollView setCurrentPage:[pageControl currentPage]];
}

- (void) didChoosePage:(int)page{
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:1.0];
    UIView *pageVC = [self.view viewWithTag:PREFIX_TAG+page];
    UIViewAnimationTransition transition = !showDescription?UIViewAnimationTransitionFlipFromLeft:UIViewAnimationTransitionFlipFromRight;
    [UIView setAnimationTransition:transition
                           forView:pageVC
                             cache:YES];
    [self changeViewMode];
    [UIView commitAnimations];
}

- (void) changeViewMode{
    showDescription = !showDescription;
    for (int page=0; page<[articles count]; page++) {
        UIView *pageVC = [self.view viewWithTag:PREFIX_TAG+page];
        [[pageVC viewWithTag:VIEW_DESCR_TAG] setHidden:!showDescription];
        [[pageVC viewWithTag:VIEW_FRONT_TAG] setHidden:showDescription];
    }
    [scrollView setScrollEnabled:!showDescription];
    [pageControl setHidden:showDescription];
}
- (void) scrollViewChangedPage:(NSNumber*)page{
    pageControl.currentPage = [page intValue];
}

- (void) resize{
    scrollView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
    pageControl.frame = CGRectMake(20, self.view.frame.size.height-36, self.view.frame.size.width-40, 36);
    pageControlBG.frame = pageControl.frame;
    [imageBG setFrame:scrollView.frame];

}

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc. that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

+ (BOOL) showDescription{
    return showDescription;
}

- (void)dealloc {
    [pages release];
    [super dealloc];
}


@end

// ArticlePageVC.h

//  ArticlePageVC.h


#import <UIKit/UIKit.h>
#import "TabListViewController.h"
#import "AsyncImageView.h"

#import "TabHTMLViewController.h"

@interface ArticlePageVC : UIViewController {

    IBOutlet AsyncImageView *asyncImage;
    IBOutlet UILabel *label;
    IBOutlet UIImageView *labelBG;

    IBOutlet UIWebView *body;
    IBOutlet UILabel *detailLabel;
    IBOutlet UIImageView *detailLabelBG;

    IBOutlet UIImageView *pageControlBG;

    ListItem *article;
}

@property (nonatomic,retain) ListItem *article;
- (void)resize;


@end

// ArticlePageVC.m

//  ArticlePageVC.m


#import "ArticlePageVC.h"
#import "ArticleScrollVC.h"

@implementation ArticlePageVC

@synthesize article;

// The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
/*
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization.
    }
    return self;
}
*/

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
    [asyncImage changeContentMode:UIViewContentModeScaleAspectFit];
    [asyncImage loadImageFromURL:[NSURL URLWithString:article.thumbnailURL]];
    label.text = article.title;
    detailLabel.text = article.title;
    [body loadHTMLString:[article content] baseURL:nil];
    [pageControlBG setImage:[UIImage imageNamed:@"page_control_bg.png"]];

    body.scalesPageToFit = YES;

}

- (void) resize:(CGRect)frame{

    UIDevice *dev = [UIDevice currentDevice];
    NSString *deviceModel = dev.model;
//  ArticlePageVC *pageVC;

    if([deviceModel isEqual:@"iPad"] || [deviceModel isEqual:@"iPad Simulator"]){
        self.view.frame = frame;
        [body setFrame:CGRectMake(20, 130, frame.size.width-40, frame.size.height-130)];

        [label setFrame:CGRectMake(40, frame.size.height-340, frame.size.width-100, 320)];
        [asyncImage resize:CGRectMake(frame.origin.x+10, 0, asyncImage.frame.size.width-40, frame.size.height-286-2)];
        [labelBG setFrame:CGRectMake(20, frame.size.height-320, frame.size.width-40, 284)];
        [pageControlBG setFrame:CGRectMake(20, frame.size.height-36, frame.size.width-40, 36)];
    }else {
        self.view.frame = frame;
        [body setFrame:CGRectMake(20, 120, frame.size.width-40, frame.size.height-120)];

        [label setFrame:CGRectMake(40, frame.size.height-156, frame.size.width-100, 120)];
        [asyncImage resize:CGRectMake(frame.origin.x+10, frame.origin.y+1, asyncImage.frame.size.width-40, frame.size.height-136-2)];
        [labelBG setFrame:CGRectMake(20, frame.size.height-156, frame.size.width-40, 120)];
        [pageControlBG setFrame:CGRectMake(20, frame.size.height-36, frame.size.width-40, 36)];
    }



    [[self.view viewWithTag:VIEW_DESCR_TAG] setHidden:![ArticleScrollVC showDescription]];
    [[self.view viewWithTag:VIEW_FRONT_TAG] setHidden:[ArticleScrollVC showDescription]];
}



- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc. that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}


@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:43:06+00:00Added an answer on May 22, 2026 at 10:43 pm

    Adopt the UIWebViewDelegate protocol in your view controller, and then implement -webView:shouldStartLoadWithRequest:navigationType: such that it sends the application an -openURL: message with the url and returns NO to prevent the web view from opening it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Cocoa app that uses a WebView to display an HTML interface.
In my project (iPhone app) I have a nice webview to allow users to
I have loaded an external URL in my WebView . Now what I need
I have an app that works with tabs and webview. I already have it
I currently have a UIWebView that is displayed within a modal view. It is
I have Activity with some data displayed in WebView that I load with WebView#loadDataWithBaseURL
i have a String displayed on a WebView as Siwy & Para Wino i
I have a DialogFragment (displayed as a dialog) whose layout contains a WebView control.
I have an app with a table view at the root in a navigation
I want to have webview displayed fullscreen with action bar on top of it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.