ruslanskorb/RSKGrowingTextView

delegate method is not called

Closed this issue · 2 comments

Hi,

I have added the TextView Programmatically. None of the delegate methods are called. Is there any other way to get the delegate callbacks in Objective-C ?

Here is the code

self.containerView = [[UIView alloc] initWithFrame:CGRectMake(0,screenHeight-155, screenWidth, 40)];
        self.grTextView = [[RSKGrowingTextView alloc] initWithFrame:CGRectMake(45, 0, screenWidth-100, 40)];
        self.grTextView.minimumNumberOfLines = 1;
        self.grTextView.maximumNumberOfLines = 4;
        self.grTextView.delegate = self;
        self.grTextView.placeholder = NSLocalizedString(@"write_comment", nil);
        self.grTextView.autoresizingMask = UIViewAutoresizingFlexibleWidth;

        [self.view addSubview:self.containerView];
        [self.view bringSubviewToFront:self.containerView];
        [self.containerView addSubview:self.grTextView];

And the delegate callback method. I have added breakpoint but it's not calling

- (void)growingTextView:(RSKGrowingTextView * _Nonnull)textView willChangeHeightFrom:(CGFloat)growingTextViewHeightBegin to:(CGFloat)growingTextViewHeightEnd {
    
    float diff = (textView.frame.size.height - growingTextViewHeightEnd);
    CGRect r = self.containerView.frame;
    r.size.height -= diff;
    r.origin.y += diff;
    self.containerView.frame = r;
}

@rahulvyas You need to use grTextView.growingTextViewDelegate instead of grTextView.delegate . Please use version 6.0.3 of RSKGrowingTextView.

Thanks for the update