ios 5 shows white font on textView - ios

I have a textView, in an ipad app, im using the following,
self.textView = [[[UITextView alloc] initWithFrame:CGRectMake(25, 73, 665, 85)] autorelease];
self.textView.delegate = self;
[self.textView setTextColor:[UIColor blueColor]];
[self.textView setFont:[UIFont systemFontOfSize:18.0f]];
//[self.textView setTextColor:[UIColor colorWithRed:153/255.0 green:153/255.0 blue:153/255.0 alpha:1]]; //color
//self.textView.textColor =[UIColor grayColor];
[self addSubview:self.textView];
it shows the right font color on ios 4, but on ios5 the font goes WHITE???
why?
ios4
ios5
how to fix this?
thanks!

Theres nothing in the code you provided that would indicate the textView turing text White. There must be some other method you are not including that is setting this text white. I would do a search for white throughout your project to see if the color is getting set somewhere else. Also, I would check Interface Builder to see if theres any indication of the text being changed to White.

Related

UITableView background color iOS 9

I have a UITableView that I want to set its background color to transparent. Background color for the table view and all subviews at interface builder is set to transparent. It works fine for iOS 8 & 7. but, not iOS 9. any idea?
cellForRowAtIndexPath method:
[cell setSelectedBackgroundView:[[UIView alloc] init]];
[cell.selectedBackgroundView setBackgroundColor:[UIColor clearColor]];
[cell setBackgroundColor:[UIColor clearColor]];
[cell.contentView setBackgroundColor:[UIColor clearColor]];
[cell setBackgroundView:[[UIView alloc] init]];
[cell.backgroundView setBackgroundColor:[UIColor clearColor]];
Objective-c:
[self.yourTableView setBackgroundColor:[UIColor clearColor]];
Swift:
self.yourTableView.backgroundColor = .clear
XCode 7.0 bug. Not picking up from Storyboard
This happens to me even when creating an UITableView in code, and setting it as a private property of my UIViewController. However, if the UITableView is a global variable, this problem does not occur.
I suspect Apple is rooting around the ivars on my UIViewController, setting UITableView's background colors to UIColor whiteColor without asking me. I have checked, and the calls to do go through setBackgroundColor on the UITableView.

UITextView responding to touches, but keyboard doesn't appear

I can't comprehend it. I have a uitextview which animates upward when it begins editing to make room for the keyboard. I tap the uitextview and registers that it has begun editing and it animates up but the keyboard doesn't appear. This has never happened before and I've tested the app hundreds of times. I even have the textview become first responder upon building the view and the keyboard still doesn't show.
I have the .m file and .h file as so that is not the issue..
Here is the set up code:
self.addDescriptionTextView = [[UITextView alloc] initWithFrame:CGRectMake(0, 470, 320, 100)];
[self.addDescriptionTextView setBackgroundColor:[UIColor colorWith8BitRed:0 green:0 blue:0 alpha:.5]];
[self.addDescriptionTextView setTextColor: [UIColor whiteColor]];
[self.addDescriptionTextView setFont:[UIFont fontWithName:#"Verdana" size:16]];
[self.addDescriptionTextView setDelegate:self];
self.addDescriptionTextView.textContainer.maximumNumberOfLines = 10;
[self.addDescriptionTextView.layoutManager textContainerChangedGeometry:self.addDescriptionTextView.textContainer];
[confirmView addSubview:self.addDescriptionTextView];
I ran your code on my iOS device and the keyboard came up,
Heres the viewDidLoad Code I ran,
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.addDescriptionTextView = [[UITextView alloc] initWithFrame:CGRectMake(0, 470, 320, 100)];
self.addDescriptionTextView.backgroundColor = [UIColor redColor];
[self.addDescriptionTextView setTextColor: [UIColor whiteColor]];
[self.addDescriptionTextView setFont:[UIFont fontWithName:#"Verdana" size:16]];
[self.addDescriptionTextView setDelegate:self];
self.addDescriptionTextView.textContainer.maximumNumberOfLines = 10;
[self.addDescriptionTextView.layoutManager textContainerChangedGeometry:self.addDescriptionTextView.textContainer];
self.addDescriptionTextView.editable = YES;
[self.view addSubview:self.addDescriptionTextView];
}
Try adding the UIView.editable line but it should be set to yes automatically.
It might have something to do with confirmView?
Also try changing the UIColor Background colour line I was getting errors with your one.
Edit: After running on iPhone4s your problem is the position you initiate the UIView (to see try changing the 470 to 0 in the CGRect to see the bug)

UITextView throws EXC_BAD_ACCESS

I've created a UITextView instance and I'm trying to set its font:
UITextView *dummy = [[UITextView alloc] initWithFrame:self.frame];
dummy.font = [UIFont fontWithName:#"HelveticaNeue-Light" size:14];//self.font;
However, at that second line, I'm getting EXC_BAD_ACCESS error, hitting continue execution doesn't do anything. It still hangs at the same line forever, with no error message at the console. It also used to throw at self.font too (I'm using the code inside a working UILabel and its font is a valid font object). Why am I getting this error?
UPDATE: I've also tried setText: it also throws the same too. Am I missing something obvious?
Try this code.
UITextView *textview =[[UITextView alloc]init];
textview.frame=CGRectMake(200, 10, 500, 50);
//To make the border look very close to a UITextField
[textview.layer setBorderColor:[[[UIColor grayColor] colorWithAlphaComponent:0.5] CGColor]];
[textview.layer setBorderWidth:2.0];
textview.delegate=self;
//The rounded corner part, where you specify your view's corner radius:
textview.layer.cornerRadius = 5;
textview.clipsToBounds = YES;
[textview setFont:[UIFont fontWithName:#"Helvetica Neue" size:11]];
[textview setTextColor:[UIColor blueColor]];
[textview setReturnKeyType:UIReturnKeyDone];
I've found the solution.
I've tried [[UITextView alloc] initWithFrame:self.frame textContainer:nil]; instead of [[UITextView alloc] initWithFrame:self.frame]; and it worked. I don't understand why the other method didn't work, and this one works even though I'm using nil as the textContainer.

Back button title missing with long screen title in iOS 7

I am seeing that "Back" button title is missing when my screen title is big. I needed to show the entire title. Is there any workaround to this?
Please see attached the screenshot of navigation bar I see with long title.
Make your screen title smaller. You can take control of it by using a titleView that's a UILabel. The advantage is that you can set its size, and that it can truncate its text and/or make the text occupy two lines if the text is too big (rather than just growing, as the title does).
UIView *iv = [[UIView alloc] initWithFrame:CGRectMake(0,0,170,35)];
[iv setBackgroundColor:[UIColor whiteColor]];
_titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 170, 35)];
_titleLabel.textAlignment = UITextAlignmentCenter;
[_titleLabel setFont:[UIFont boldSystemFontOfSize:16.0]];
[_titleLabel setBackgroundColor:[UIColor clearColor]];
[_titleLabel setTextColor:[UIColor blackColor]];
[_titleLabel setText:#""];
_titleLabel.clipsToBounds = false;
iv.clipsToBounds = false;
[iv addSubview:_titleLabel];
[self.navigationItem setTitleView:iv];
also you need
#property (strong, nonatomic) UILabel* titleLabel;

How can I change de size of the title in my navigation bar to fit a text

Well I need to change a text on my navigation control bar to fit a movie "title" longer than the space available. I've see more code for resize the text using a label like this:
UILabel *bigLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 120, 30)];
bigLabel.text = titoloSource;
bigLabel.font = [UIFont systemFontOfSize:22.0];
[bigLabel setFont:[UIFont boldSystemFontOfSize:16.0]];
[bigLabel setBackgroundColor:[UIColor clearColor]];
[bigLabel setTextColor:[UIColor whiteColor]];
[bigLabel setText:self.title];
[self.navigationController.navigationBar.topItem setTitleView:bigLabel];
self.navigationItem.titleView = bigLabel;
But I Know that the appel GUI line guide say that we can't make a small text below a certain measure. Now I've think: WHY CAN'T I MAKE an animated slider text?
So, Someone know a way to make a text animated that scroll all the "title" inside a label???
thanks

Resources