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 3674258
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:50:00+00:00 2026-05-19T02:50:00+00:00

When creating the content view of a tableViewCell, I used the drawInRect:withFont, drawAtPoint… and

  • 0

When creating the content view of a tableViewCell, I used the drawInRect:withFont, drawAtPoint… and others, inside drawRect: since all I needed was to lay some text. Turns out, part of the text drawn need to be clickable URLs. So I decided to create a UIWebView and insert it into my drawRect. Everything seems to be laid out fine, the problem is that interaction with the UIWebView is not happening. I tried enabling the interaction, did not work. I want to know, since with drawRect: I am drawing to the current graphics context, there is anything I can do to have my subviews interact with the user?
here is some of my code I use inside the UITableViewCell class.

-(void) drawRect:(CGRect)rect{  
    NSString *comment = @"something";
    [comment drawAtPoint:point forWidth:195 withFont:someFont lineBreakMode:UILineBreakModeMiddleTruncation];

    NSString *anotherCommentWithURL = @"this comment has a URL http://twtr.us";
    UIWebView *webView = [[UIWebView alloc] initWithFrame:someFrame];
    webView.delegate = self;
    webView.text = anotherCommentWithURL;
    [self addSubView:webView];
    [webView release];
}

As I said, the view draws fine, but there is no interaction with the webView from the outside. the URL gets embedded into HTML and should be clickable. It is not. I got it working on another view, but on that one I lay the views.
Any ideas?

  • 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-19T02:50:00+00:00Added an answer on May 19, 2026 at 2:50 am

    You do not want to be creating a new UIWebView and adding it as a subview for each call to drawRect: This is an extremely bad idea:

    1. It’s going to be slow. Those are heavy objects, and you’re creating thousands of them.
    2. You’re not getting rid of the old UIWebView objects. So you’re essentially layering thousands and thousands of them on top of one another.

    You should be creating the UIWebView once, probably in the initializer, or some other method that is only called once. You should also add it as a subview only once.

    The act of creating thousands of those views could certainly be causing your problem.

    If your view is changing position/size, then you can override setFrame: and in addition to calling the superclass’ method, tweak the frame of the UIWebView, which you’ll definitely want to maintain as an instance variable.

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

Sidebar

Related Questions

I am creating an NSURLMutableRequest and setting HTTP methods and content-types and such. All
Im creating a View object and set it as the content view on activity.
I'm creating a Dialog, setting a content view with two Buttons, and displaying it.
I'm creating Content management system in asp.net. But I need open source cascading stylesheet
I'm using drupal 7.x and am creating a node content-type template. My content type
I have a scenario that, I am creating dynamic html content and I need
I'm creating a Facebook app in which I want to display content depending on
I am creating a little script that allows me to slide my content sections
I've been wrangling with creating my own File Browser Content Provider for Telerik's FileExplorer
I am creating a business application that has a variable width sidebar and content

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.