I have a simple leader boards table for an iphone game that allows me to view the previous high scores however the background is black and therefore it is not visible. I am using the code:
[highscores addObject:[NSArray arrayWithObjects:#"Title",[NSNumber numberWithInt:5000],nil]];
Can I change the colour easily?
All help greatly appreciated, I expect it is simple but google is coming back with little.
Thanks in advanced!
changing the color is not related with an Array.Its related with the container who displays the Title .
you may binding the Title string to any UILabel.
So you have to set the textColor property to white.
Eg: label1.textColor = [UIColor whiteColor];
To make the UILabel white, remove this code:
[label1 setRGB:0 :0 :0];
And add do this instead:
[label1 setTextColor:[UIColor whiteColor]];
Let me know if this helps you. Posting your code definitely helps. You are doing great at age 14, so keep it up.
Related
I want to change the color of my UIButton. I did this:
UIButton *alreadySubscriber = [[UIButton alloc] initWithFrame:CGRectMake(12, maxy-65, 262.0, 50)];
alreadySubscriber.layer.cornerRadius = 10.0f;
[alreadySubscriber setBackgroundColor:[UIColor orangeColor]];
[alreadySubscriber setTitle:#"Already a subscriber" forState:UIControlStateNormal];
The color of the button changes, but no longer see the effect of bright light booby top. how can I fix this?
We're unable to programmatically set this 'bubble effect' for the UIButton I'm afraid. The only way to go about it far as I can tell is to go for a custom button with an image (or two images for the normal and active states).
The resource Eugene put up earlier seems pretty good in fact.
I don't really know what kind of booby light are you talking about, but have you tried using images for your buttons? I'd suggest using two different images like those you can create here http://dabuttonfactory.com/.
You should create as a custom button and add the image/color as background.
Hey, I was wondering how I could make the user being able to change the background of the app? I have 3 Images that the user will be able to choose from. I've seen it in many apps. How would I do this? If possible please provide some code! :)
Thank you in advance!
It's quite easy. All you need is to set the background property of your view to an image. Here's how it's done:
self.view.backgroundColor = [UIColor colorWithPatternImage:
[UIImage imageNamed:#"yourimage.png"]];
Now, when the user selects a different image, simply repeat the above code with a different image each time.
The question should be more clear.
You can change the background of the UIView or parent UIWindow by using,
view/window.backgroundColor = [UIColor colorWithPatternImage: image]
or Use the UIImageView,
imageView.image = image
I am making an iPhone app, and I want know how make a variable background image a background that the user can choose one of the options ?
I don't know what you want in the foreground, but anything based on the UIView class has a backgroundColor property that you can set to an image like this:
yourView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"YourImage.png"]];
It didn't work for me, what it worked was:
self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:#"background.png"]];
I think is the same, but don't know why the other answer didn't work for me.
Hope it helps.
I have a custom iPhone-App what uses the barcode reader zbar.
My problem is the tracking border color what is green (my customers most hated color because its the competitors CI-color).
Is there any chance to programmatically change this color to f.e. red or blue?
Thanks in advance!
In the ZBar sdk, ZBarReaderView has a method called "TrackingColor". The default is green.
Here is the code to change the tracking color:
reader.trackingColor = [UIColor redColor];
I am using a TabBar. So here is the code I used to get it to work:
ZBarReaderViewController *reader = [tabBarController.viewControllers objectAtIndex: 0];
reader.readerDelegate = self;
reader.readerView.trackingColor = [UIColor redColor];
I hope this helps!
The problem is already solved.
With help from spadix (http://sourceforge.net/users/spadix/) this feature is added to the current SDK version.
More information here: http://sourceforge.net/projects/zbar/forums/forum/1072195/topic/4036084
just switched to iOS 4 on my iPhone 3GS and some of my apps broke.
One issue I had is that I had a UIToolbar with some buttons, tinted to pink, that worked well on the 3.1.3 OS. After upgrading to iOS 4, the toolbar was still tinted, but the buttons it contained were no longer affected by the tint. The toolbar was pink while the buttons were regular-blue.
Looked around for it on the net, but found no reference of such a thing.
Anyone knows what broke in the process?
(must be frank here - I knew the answer before posting, just didn't know how to load this data to StackOverflow. Thought the solution I found was valuable for others, so wanted to post it here. I'm new here, so please no harsh critics :) )
So eventually the problem resulted from, AFAICT, a change in behavior in the OS.
As stated the tint code worked before the upgrade and was written like this:
// Toolbar content
NSArray *items=[NSArray arrayWithObjects: ... ]; // PSEUDO CODE HERE
[toolbar setItems:items];
// Add tint
toolbar.tintColor = [UIColor colorWithRed:0.83 green:0.43 blue:0.57 alpha:0.5];
What I needed to do, was just reverse the order of things:
// Add tint
toolbar.tintColor = [UIColor colorWithRed:0.83 green:0.43 blue:0.57 alpha:0.5];
// Toolbar content
NSArray *items=[NSArray arrayWithObjects: ... ]; // PSEUDO CODE HERE
[toolbar setItems:items];
(If you created UIToolbar in Interface Builder, you can change it's tint there, and that applies for the buttons as well).
I guess the tint updated all buttons before iOS 4, while in iOS 4 it doesn't and when adding buttons, they check for existing tint. But this is just a guess. The solution works anyhow..
Hope this helps someone, and that I didn't violate any sacred SO rules...
Cheers!
Well, it seems more like an OS bug than a feature, since navigation bars do change their item's color when you set their tintColor.
We've found that if you change the item's style, it refreshes their color as a side effect. Doing the following worked in our case. The original buttons are bordered, so we change them to plain and set them to bordered again. You may do a more complicated and generic code that saves the current style, sets another one and then switchs back. I am just to lazy to do that. :D Anyway, you get the idea.
toolbar.tintColor = //<some dynamically obtained UIColor>
// Workaround to properly set the UIBarButtonItem's tint color in iOS 4
for (UIBarButtonItem * item in toolbar.items)
{
item.style = UIBarButtonItemStylePlain;
item.style = UIBarButtonItemStyleBordered;
}
Regards,
Rula.