Invisible text on ipad?
Hi This might be a general UITextView issue on iPad, so Im not sure if this question is targeted correctly.
Anyways, the problem I came across is that the text entered in the textview on ipad is invisible, although the same code works fine on iphone, i.e. black text is visible on white background in the textview. The project is a iphone-only app, so there are no special handling done for iPad as platform.
Below is a listing of how I create the HPGrowingTextView in viewDidLoad method, anyone having an idea how to solve the issue with invisible text on ipad?
self.chatTextView = [[HPGrowingTextView alloc] initWithFrame:CGRectMake(85, 5, 165, 28)]; self.chatTextView.animateHeightChange = YES; self.chatTextView.contentInset = UIEdgeInsetsZero; self.chatTextView.minNumberOfLines = 1; self.chatTextView.maxNumberOfLines = kMessageChatTextViewMaxLines; self.chatTextView.font = self.customFont; self.chatTextView.textColor = [UIColor blackColor]; self.chatTextView.delegate = self; self.chatTextView.backgroundColor = [UIColor whiteColor]; self.chatTextView.autoresizingMask = UIViewAutoresizingFlexibleWidth; self.chatTextView.layer.masksToBounds = YES; self.chatTextView.layer.cornerRadius = 3.0;
UIImage *rawEntryBackground = [UIImage imageNamed:@"MessageEntryInputField.png"]; UIEdgeInsets imgInsets = UIEdgeInsetsMake(10.f, 10.f, 10.f, 10.f); UIImage *entryBackground = [rawEntryBackground resizableImageWithCapInsets:imgInsets];
UIImageView *entryImageView = [[UIImageView alloc] initWithImage:entryBackground];
entryImageView.frame = CGRectMake(85, 5, 165, 34);
entryImageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
UIImage *background = [UIImage imageNamed:@"MessageEntryBackground.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:background];
imageView.frame = CGRectMake(0, 0, self.chatViewContainer.frame.size.width, self.chatViewContainer.frame.size.height);
imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
UIImageView *chatboxFix = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"chatbox_fix.png"]];
chatboxFix.frame = CGRectMake(85, 34, 165, 15);
[chatboxFix setAutoresizingMask:UIViewAutoresizingFlexibleTopMargin];
[self.chatViewContainer addSubview:imageView];
[self.chatViewContainer addSubview:self.chatTextView];
[self.chatViewContainer addSubview:entryImageView];
[self.chatViewContainer addSubview:self.sendButton];
[self.chatViewContainer addSubview:self.attachmentButton];
[self.chatViewContainer addSubview:chatboxFix];
Same problem. If I set the width twice, first with a width less than 500 and then set the width to a wider width it works.