Set custom UITabBar font color under iOS7 - uitabbar

It seems that [[UITabBar appearance] setSelectedImageTintColor:[UIColor redColor]]; is no longer working propertly under iOS7. I can set the background image, but the selected text is no longer getting the red color. I'm calling this from my application delegate. Has anyone tried to set the UITabBar font color and style under iOS7?

It worked for me..
[[UITabBar appearance] setBarTintColor:[UIColor blackColor]];
[[UITabBar appearance] setTintColor:[UIColor whiteColor]];

It is tintColor in iOS7, try the below:
[[UITabBar appearance] setTintColor:[UIColor redColor]];
Edit:
To tint the non active buttons, put the below code in your VC's viewDidLoad:
[self.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:#"item_seleted.png"] withFinishedUnselectedImage:[UIImage imageNamed:#"item_unselected.png"]];

To tint not active items I used this
UITabBarItem *item = [self.tabBar.items objectAtIndex:1];
// here you need to use the icon with the color you want, as it will be rendered as it is
item.image = [[UIImage imageNamed:#"unselected.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
// this icon is used for selected tab and it will get tinted as defined in self.tabBar.tintColor
item.selectedImage = [UIImage imageNamed:#"selected.png"];

Related

How to change ion-nav-bar background colour dynamically

I am new to ionic app development and basically i have a radio list a user can select options from and for each option i have set up a background colour and what i want it to do is to change the background colour whenever the user selects an option. the problem is that it changes to the initial option but it doesn't change the colour after the initial load although when i inspect the page i can see it has changed the class name.
this is my html
<ion-nav-bar class="bar-{{viewColor}} nav-title-slide-ios7" align-title="center">
<ion-nav-back-button class="button-icon ion-arrow-left-c">
</ion-nav-back-button>
</ion-nav-bar>
and this is how i am assigning the viewColor variable in my js
$scope.viewColor = "positive";
thanks in advance
Try using ionicView.beforeEnter method, set the viewcolor value before the page has finish loaded.
$scope.$on('$ionicView.beforeEnter', function () {
$scope.viewColor = "positive";
});
After playing around with different solutions (which didn't work) I ended up using ion-header-bar instead of ion-nav-bar and it works! The colour changes dynamically with the users selections. The only downside to it is that I have to create a header for each view and handle the application state myself

Windows Phone 8 ApplicationBar expanded unchangable transparancy

following Code...
<!--Navigation-Bar-->
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" ForegroundColor="White" IsMenuEnabled="True" BackgroundColor="#002B55">
<shell:ApplicationBarIconButton Click="B_Search_Click" IconUri="Images\Pic_Search.png" Text="Search"/>
<shell:ApplicationBarIconButton Click="B_Media_Click" IconUri="Images\Pic_Media.png" Text="Media"/>
<shell:ApplicationBarIconButton Click="B_Scan_Click" IconUri="Images\Pic_Scan.png" Text="Scanner"/>
<shell:ApplicationBarIconButton Click="B_Charts_Click" IconUri="Images\Pic_Charts.png" Text="Charts"/>
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem Click="B_Logout_Click" Text="Logout"/>
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
gives me following ApplicationBar...
http://s14.directupload.net/file/d/3341/4xiadbvz_jpg.htm
(Solid background when expanded)
BUT if I create the AppBar in CodeBehind like this...
private void ResetApplicationBar()
{
ApplicationBar = new ApplicationBar();
ApplicationBar.BackgroundColor = Color.FromArgb(150, 0, 43, 85);;
ApplicationBar.ForegroundColor = Colors.White;
ApplicationBar.Opacity = 1;
ApplicationBarIconButton B_Search = new ApplicationBarIconButton();
B_Search.IconUri = new Uri("/Images/Pic_Search.png", UriKind.Relative);
B_Search.Text = "search";
ApplicationBar.Buttons.Add(B_Search);
B_Search.Click += new EventHandler(B_Search_Click);
(more Buttons...)
then I get that misterios unchangable Transparency...
http://s1.directupload.net/file/d/3341/zjo57e37_jpg.htm
(Half-Transparent when expanded)
How can I change the Background to solid???
-Yes I have mostly overwritten the theme
-Changing global colors doesnt work
-changing background/foreground doesnt work
-changing opacity doesnt work...
I need to generate it from code behind because im changing it dynamically in one window
(or is it possible to define multiple AppBars in markup?)
Thanks in advance!
Please try this one
ApplicationBar.BackgroundColor = Color.FromArgb(52,0,2,181);
ApplicationBar.ForegroundColor = Colors.White;
You will get the same color in designer page by this way.
This (52,0,2,181) is the conversion value of #002B55
On a fresh project, everything seems fine, here.
"- changing background/foreground doesnt work
- changing opacity doesnt work..."
Using the Application Bar sample, you provided in XAML, but with Opacity=0.5, I get this :
After I click the "Change Color" button, which does ApplicationBar.Opacity = 1;, I get this result :
(The background image is slightly moved up, because in first case we provided an opacity and in the second there was none explicitly specified and it seems the app bar didn't layered over the image, but to fix this you can set an Opacity=0.999, close to 1).
It must have something to do with all the theme overwriting you have done or some customization you attempted.
If this isn't quite helpful, provide me more details and I'll try to help as I can.
Thank you very much for effort, but changing opacity didnt to 0.999 didnt help either.
I found a solution!! And its quite simple :)
I Just take the old bar instead of creating a new one:
//Old Code
ApplicationBar = new ApplicationBar();
//New Code
ApplicationBar.Buttons.Clear();
ApplicationBar.MenuItems.Clear();
Hope it helps someone!

Cannot produce a background image in a panel in Google Apps Script (GAS)

I was under the impression that 'backgroundIamge' is supposed to be supported in .setStyleAttribute to allow the user to set a background image in a panel via something like this:
setStyleAttribute("backgroundImage","url('myImageUrl')");
However, when I try the following:
var panel = app.createVerticalPanel().setId('panel')
.setStyleAttribute('text-align', 'center')
.setStyleAttribute('zIndex', '3')
.setStyleAttribute('position', 'fixed')
.setStyleAttribute('left', 10)
.setStyleAttribute('top', 10)
.setWidth(250)
.setHeight(150)
.setStyleAttribute('backgroundImage',"url('https://myImage.png')");
I cannot produce a background image in the panel. The funny thing is the exact same code will produce a background image in a button. I have tried 'background' and 'background-image' as well to no avail. Is 'backgroundImage' NOT supported for panels or am I missing something?
I figured it out...you need to use createAbsolutePanel or add an empty label to other types of panels.

AIR Mobile Embedded Font

I am trying to change the default font of a text field in an AIR Mobile app.
What I dos first embed the font using this line:
[Embed(source='C:/WINDOWS/Fonts/ARIAL.TTF', fontName="_Arial", mimeType="application/x-font-truetype")]
After that, I create a TextFormat with this font: style.font = "_Arial"; and set it to the text field: tf.setTextFormat(style);
Sadly, the font does not change.
Anyone knows what I am doing wrong?
You need to use:
tf.defaultTextFormat = style;
There are differenced between defaultTextFormat and setTextFormat
setTextFormat
defaultTextFormat
UPDATE:
not sure why this is not working what you have there, but i managed to make it working, just replace the font embedding line with this:
[Embed(systemFont="Arial", fontName="_Arial", mimeType="application/x-font-truetype", embedAsCFF="false")]
Did you set the textfield.embedfont = true. ?

Adding custom UIView to UIViewController in - (void)loadView (Objective-C)

I am taking a programming class (for noobs) and I need to create the UIViewController graphViewController's view programmatically (without interface builder).
The view is simple, it only consists of an IBOUtlet which is an instance of a UIView subclass called GraphView. graphView responds to several multitouch gestures for zooming and panning and what-not, but I handle all of that stuff in - (void)viewDidLoad.
I am doing just the creation of the self.view property and graphView in the code below:
- (void)loadView
{
UIView *gvcView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
self.view = gvcView;
[gvcView release];
GraphView *aGraph = [[GraphView alloc] initWithFrame:self.view.bounds];
self.graphView = aGraph;
[aGraph release];
}
When I run the app I do not see the graphView view in there. I just get a transparent view which shows the "My Universal App" label. I'm stumped. Please help.
Let me know if you need additional code.
Thanks!
Update: Big thanks to BJ Homer for the quick fix!
had to do the following:
add this line of code: [self.view addSubview:self.graphView]; at the end.
I was also getting this strange bug where graphView was showing up as completely black. This line of code fixed that: self.graphView.backgroundColor = [UIColor whiteColor];
And that's it!
Final question: Is the default background color black for a custom UIView?
Thanks again!
[self.view addSubview:self.graphView];
Until you add your graph view to a parent view, UIKit doesn't know where to display it. self.view is special, since that's the property that -loadView is supposed to set. That view will automatically be added to the screen. But your graph view is just floating off in the ether until you add it somewhere.