0

I am trying to have dynamic font size for the textview.I have mad a custom class for the dynamic font size of text view.I have used following code for the custom class.

#import "CustomTextView.h"

@implementation CustomTextView


- (void)drawRect:(CGRect)rect
{
    // Drawing code
    int numLines = self.contentSize.height / self.font.lineHeight;
    self.font = [UIFont fontWithName:self.font.fontName size:((self.frame.size.height / numLines) - 4)];
    [super drawRect: rect];

}


@end

but this does not work.it shows a black color for the textview.please guide how to do it?

TechChain
  • 8,404
  • 29
  • 103
  • 228

1 Answers1

-1

There must be something wrong while implementing "CustomTextView.h" in your ViewController. Let us know how u have done the same. Share your code in ViewController. Have you added "CustomTextView" as subview in your view controller.

luckyShubhra
  • 2,731
  • 1
  • 12
  • 19