James Raitsev
James Raitsev

Reputation: 96501

UITextView does not scroll, assistance needed

The following snippet shows up on the screen on top of correct background, however text does not scroll.

What am i missing please?

-(void) viewWillAppear:(BOOL)animated {

    UITextView *scrollableText = [[UITextView alloc] initWithFrame:CGRectMake(20, 20, 300, 800)];
    [scrollableText setOpaque:TRUE];
    [scrollableText setBackgroundColor:[UIColor clearColor]];

    [scrollableText setEditable:NO];
    [scrollableText setText:@"some really really long text"];

    [scrollableText setScrollEnabled:YES];

    UIImage *backgroundImage = [[UIImage alloc] initWithCGImage:[UIImage imageNamed:@"about_bg.png"].CGImage];
    UIImageView *backgroundView = [[UIImageView alloc] initWithImage:backgroundImage];

    [backgroundView addSubview:scrollableText];

    [[self view] addSubview:backgroundView];
}

Upvotes: 1

Views: 2392

Answers (2)

Falco
Falco

Reputation: 149

i have the same problem and i resolve in this mode. Put in your view a customView like OBGradientView and in this add your textView. in the code add at view your ObGradientView and at it add textview. work 100% trust to me

here the link for subview

Upvotes: 1

Ben
Ben

Reputation: 1302

Try [textview setUserInteractionEnabled:YES] or textView.userInteractionEnabled = YES; in addition to setScrollEnabled.

Upvotes: 3

Related Questions