iPhone 3.1.3: All my UIButtons and UITableRowViews are now gray - iphone

Not sure how this happened, but all of the UITableRowViews and roundrect-style UIButtons in my app—spanning a dozen or so views—are now all gray instead of white.
Unfortunately, I have no idea how this happened. (In fact, I had no idea it was possible to do this.) Explicitly setting the button's or tableRowView's background color to white gets it back to normal. But it'll be a lot of work to do that to every one of my views...and I'd rather not have to do it since there's obviously something simple that caused it in the first place.
How did I break this?
Thanks very much.

Bizarre: if you add a static method into some UIColor category and call it +(UIColor*)tableViewBackground, it'll change all your tables and buttons to that color.
Must interfere with some hidden method in Apple's UIColor implementation.
I fixed my problem by simply using a different name ("viewBackgroundColor").

You could select all of them (Cmd+A or drag a rectangle) and change the background color back to white.

Related

How to use the loading black screen control in ios?

I'm not asking for the full implementation here.
I'm asking because I don't even know what it is called, if somebody could at least tell me the
class I can work with that.
thanks
There is no built-in class for this. However, it can be accomplished using a UIWindow and some views. You should browse http://cocoacontrols.com, they have quite a few open-source versions of this.
For example:
MBProgressHUD: https://www.cocoacontrols.com/controls/mbprogresshud
DejalActivityView: https://www.cocoacontrols.com/controls/dejalactivityview
MMProgressHUD: https://github.com/mutualmobile/MMProgressHUD
It's just a partly transparent UIView with black background and a corner radius of about 15, containing an activity indicator and a label. You can create it in a .xib for easy layout and then load it as needed.

How can I prevent Xcode from changing the color of my buttons?

So I've done a button for my iPad app, and I saw something strange. When I run my app in the iOS 5 simulator, it changes the color, and the lines of my button become discontinuous. But when I push it, the button comes back to the right color, and the lines are ok. I think it's something that Xcode does automatically with any button, and I don't find the way to cancel it. Thank you for helping!
PS: The button code is so simple:
IBOutlet UIButton *button;
This is what it should look like:
And this is how it looks in the simulator:
Both tams and JacobFennell have good points, but you should also note that graphics are often represented much differently on the simulator than on a real device. You should try running your app on a device and see if the problem persists; I have had many 'problems' with custom buttons which turned out just to be improper rendering on the part of the simulator.
Since you are using the Interface builder, make sure that you are setting the button type to custom and that you have changed the behavior for all of the states. Under the dropdown menu of where you can set the type they also have StateConfig, where you can configure the look and text of your button for all of its different states: highlighted, default, disabled...Check that those settings are correct as well.
Hope this helps!
Tams
Your button frame size doesn't seem to match the size of your image. Your art should match the (button/view) frame size pixel for pixel, otherwise you may get blurry images and scaling representation artifacts.
Else, you can change the view content mode (UIViewContentMode) of the frame from UIViewContentModeScaleToFill to UIViewContentModeTopLeft

Question about UIWindow backgrounds

I have written a powerful trig calculator, but I want to use the "linen" background. I have been able to implement this in interface builder, but I get a 'yellow triangle' warning in Xcode that says it is not compatible with something like iOS 3.2 and earlier. And I'm afraid Apple will reject it if says that. I want to know the code that I can use to change both the text color (from black to white) and the background texture (from blue and white vertical stripes to the darker linen). I already know a few ways to test and apply info about the users current firmware version, but I'm always open to suggestions. Any help will be GREATLY APPRECIATED!!! I have just read the first 3 answers and duh I feel kinda stupid, that makes sense. But I would also like to know how to do this and make it like a user configurable "setting" just to make it feel nicer :-) thanks
The linen background is a tiling UIColor. You can create a tile color programmatically and apply this tiled background anywhere you would set a backgroundColor. Even on UIWindow.
If you want to maintain compatibility to old iOS versions, replace the built in background "color" (such as linen) with an UIImageView showing an image of it.
Write a simple app, filling the entire screen with the background, make a screenshot, then place it behind all other UI elements.

UILabel text on iPad not resizing

I have iOS 4.3 installed on my iPad. I'm noticing that my text in my UILabels is not resizing. In other words, I'm adding letters, but it's just truncating. Same settings work find on iPhone also running 4.3. I'm perplexed. I've made certain that "Adjust to fit" is checked on the label properties. I've even set it in the code with .adjustsFontSizeToFitWidth and even tried calling sizeToFit.
None of these let the text resize.
Does anyone else have this problem?
Any ideas?
My next solution is going to use this: Check if label is truncated to try and manually resize the label text.
I finally figured it out. I'm using OHAttributedLabel. I had intended to do some things with color in my labels and have not yet gotten around to it. It finally dawned on me that was the only difference from previous iPad versions and from the iPhone version (I never even thought to look at the class). Turns out this OHAttributedLabel class does not support resizing yet.
Sorry for wasting everyones time. Maybe someone else will someday find this useful.
Try using CGSize eLabelSize = [yourLabel.text sizeWithFont:yourLabel.font]; to get the size of the label and then you can simply modify the yourLabel.frame.size property with eLabelSize.
This worked for me in case of iPhone.
Hope this works for you if yes do communicate..... :)
Maybe it only appears as if the label is truncating text because the label frame runs out of the bounds of its parent view, which clips to its bounds? Verify the frame of the label and the autoresizing mask.
Also, the minimumFontSize property is set low enough?

UIButton resizes when I change font?

I have several UIButtons, I'm trying to bulk change the font for all of them in InterfaceBuilder, but when I change the font, they auto-resize to the original image dimensions instead of what I had them set to, screwing up the layout. I would like to avoid having to resize and move everything around again any time I change the font. I could just set the font in a loop in code, but it seems redundant.
Is there a setting to stop this from happening?
This issue doesn't seem to occur in Xcode 4.0 or above.
Should anyone still be using a lesser version of Xcode I would suggest updating.