In my app I have a UITextField which is on top of a background image. Under iOS 4 I had to set the backgroundColor property to 'clearColor' in order to make it look right. Under iOS 4 the textfield looks like this...
This is how I want it to look. Now, since upgrading to Xcode 4.3 (iOS 5) when I re-run the same project, the box looks like this...
Grrr. So under iOS 5 I changed the backgroundColor property to 'whiteColor' and it works fine. However now, under iOS 4.x the box looks like this...
Note the ugly white corners! So please, can anyone tell me what I should be doing here in order to get it to look normal under both iOS 4 and iOS 5 (i.e. To look like the first image!).
Many thanks,
Simon
I got the same problem a few days ago. To solve this, I just set the borderStyle and comment the backgroundColor line. Everything just work fine, both iOS4 and iOS5.
// textField.backgroundColor = [UIColor clearColor]; // just leave it, dont't set
textField.borderStyle = UITextBorderStyleRoundedRect;
This is what i did to resolve this issue, you can check the version of iOS running on the device and do the handling accordingly, like this
float version = [[[UIDevice currentDevice]systemVersion]floatValue];
if(version < 5.0)
{
//user clear color
}else
{
//use white color
}
Hope this helps you.
Sometimes you might have to rebuild your project. Also, try and make this in a whole new project to see if it is actually a new change to Xcode, or if it is just that particular project to narrow things down. If you then isolate it to being something wrong with your particular project, try and "do it over" to see if it clicks then. But i see you solved it :=)
Related
I'm a noob having trouble rounding the corners of my buttons using interface builder in Xcode 6.
I added a new User Defined Runtime Attribute (layer.cornerRadius) as per the below instructions:
https://stackoverflow.com/a/25164977/2903220
Unfortunately when I run the app there is no change in the button.
All other answers I've found say to do the same thing, yet it's not working.
My questions is are there other settings I should check which may cause this to not work?
(maybe it's better to do it programatically?!)
Please help! Thanks!
button.clipsToBounds = YES;
button.layer.cornerRadius = 20;//half of the width
button.layer.borderColor=[UIColor redColor].CGColor;
button.layer.borderWidth=2.0f;
Checking Clip Subviews in the attributes inspector solves the issue.
I am working on a iPad application where i am entering some dynamic text into UITextView. It is working fine if i test it on below ios 5.0. But if i test it on ios 5.0 or later, text is not appearing/visible. I have tried with the different font colors too. Any help would be appreciable.
Thanks in advance.
So, I was working on a project and ran into the same thing. In iOS versions other than 5, the UITextView worked perfectly. But, on 5, the text just simply wouldn't show up. I did possibly the hackiest thing ever to fix it. I made the parent view a UITextView delegate, and in the textViewDidChange method of that view, I added the code:
textView.text = [NSString stringWithFormat:#"\n%#",textView.text];
textView.text = [textView.text stringByReplacingCharactersInRange:NSMakeRange(0, 1) withString:#""];
This is basically a joke as far as a fix goes. That said, just quickly making it multiline and then single line fixed the problem. I'm quite sure this isn't the correct answer to this problem, but hopefully it helps someone figure out how to handle this in a pinch.
I'm aware that this question has been asked before for earlier versions of iOS, however, as far as I remember, people at the WWDC this year emphasised that we can finally customise everything very easily, e.g. the tint colours of switches (UISwitch onTintColor etc.).
I had a look at the AlertView but the only options are password input / text input. Perhaps I'm missing something obvious here, but is it still not possible to change the background tint colour of an UIAlertView in iOS 5 easily? All the other UIAlertViews in iOS are blackish/transparent, so there should be an easy way or not?
I checked the docs but couldn't find anything specific for iOS 5.
I have no idea if the background color can be changed that easily in iOS5 but traditionally speaking changing UIAlertView background is to do with setting a new image. The link you provided & this link provide help.
I had these two lines of code that worked in iOS 4. Following an upgrade to iOS 5, it no longer works.
The code would put a background image on the Navigation bar.
CGImage navban = CGImage.FromPNG(new CGDataProvider("images/banner.png"), null, false, CGColorRenderingIntent.Default);
NavigationController.NavigationBar.Layer.Contents = navban;
I am using MonoTouch. Does this no longer work in iOS 5? If so, is there another way to accomplish it?
Thanks.
The property BackgroundImageForBarMetrics of UINavigationBar should do the trick. It's new in ios5 and supports this scenario without going behind UIKit's back.
I noticed in one of my apps that the activity indicator doesn't seem to work on an iPhone 4. It works fine on an old iPhone upgraded to iOS 4 just not on an iPhone 4. Does anyone know why it isn't working?
This code should do the job, is that correct;)?
#import <QuartzCore/QuartzCore.h>
...
activityIndicatorInstance.layer.shadowColor = [UIColor grayColor].CGColor;
activityIndicatorInstance.layer.shadowRadius = 1;
activityIndicatorInstance.layer.shadowOpacity = 0.5;
activityIndicatorInstance.layer.shadowOffset = CGSizeMake(0, 1);
oddly it uses a transparent alpha channel on the iPhone 4.
A solution may be to add a kind of background...
I had the same problem, but found that if I coded it rather than using Interface Builder it worked.
If your design allows, you can also use the UIActivityIndicatorViewStyleGray or attempt to add a dark shadow to the activityView's layer.
I solve the problem, in iOS5 the frame size is already set. In iOS4 you need to set the frame size yourself. Hope it helps.