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

  • Home
  • SEARCH
  • 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 6080269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:02:31+00:00 2026-05-23T11:02:31+00:00

I’m creating a UIScrollView and add four UIWebViews as subviews. I would like to

  • 0

I’m creating a UIScrollView and add four UIWebViews as subviews.

I would like to do two things:

  1. Tag each WebViewwhile creating it, to address it inside the UIScrollView later.
  2. At a specific moment (scrollViewWillBeginDragging) send JavaScript to the UIWebView that is currently presented by the UIScrollview.

I don’t know how to tag a subview nor how to address it. So my two questions are:

Q1. How to properly tag a subview (while adding it to a UISCrollView)?

Q2. How to address a command to a subview inside the UIScrollView? ((best case: the on that is currently shown))

Thanks for your help!

Maybe the Questions clarify by looking at the actual code:

Here is the code that I use to create the UIWebviews and add them to the UIScrollview (scrollView1):

- (void)viewDidLoad{

scrollView1.delegate = self;
scrollView1.pagingEnabled = YES;
scrollView1.delaysContentTouches = NO;

NSInteger numberOfViews = 4;

for (int i = 0; i < numberOfViews; i++) {

CGFloat yOrigin = i * self.view.frame.size.width;
UIWebView *WebView1 = [[UIWebView alloc] initWithFrame:CGRectMake(yOrigin, 0, self.view.frame.size.width, self.view.frame.size.height)];

NSString *path = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"page_%d", i] ofType:@"html"];
NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[WebView1 loadRequest:request];


//HERE I'M TRYING TO TAG THE VIEW

WebView1.tag = i;

[scrollView1 addSubview:awesomeView];
[WebView1 release];

}
scrollView1.contentSize = CGSizeMake(self.view.frame.size.width * numberOfViews, self.view.frame.size.height);

Here is the code that I would like to use to Address the UIWebviews inside the UIScrollview (scrollView1):

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView1{

NSString *JavaScriptCommand = [NSString stringWithFormat:@"player.pause();"];

<strong>//HERE I'M TRYING TO ACCESS THE TAGGED VIEW</strong>

[scrollView1.????? stringByEvaluatingJavaScriptFromString:JavaScriptCommand];
}
  • 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-23T11:02:31+00:00Added an answer on May 23, 2026 at 11:02 am

    This should work

    int i = // the tag of the webview you want to address   
    [[scrollView1 viewWithTag:i] stringByEvaluatingJavaScriptFromString:JavaScriptCommand];
    

    You could store the tag of the UIWebView that is currently presented in a member of your view controller class.

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

Sidebar

Related Questions

I would like to count the length of a string with PHP. The string
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.