Customise UITabBar in RubyMotion - rubymotion

Using Rubymotion, how can I remove glossy effect on my tabbar item ?
I found this ObjC solution :
[yourTabbar setSelectionIndicatorImage:[[UIImage alloc] init]];
But the glossy effect is still there when I translate it in Ruby this way (in app_delegate.rb) :
#tab_controller.tabBar.setSelectionIndicatorImage UIImage.alloc.init
What's wrong with this ruby translation ?
I'm also using Pixate, so maybe there is an other way with simple css...

Using Pixate and CSS, you could do something like this to hide the selected state, or perhaps place an alternate image in there:
tab-bar tab-bar-item:selected {
background-color: linear-gradient(transparent, transparent);
background-size: 1;
}

Related

Set Color QTextEdit

I'm working with the QTextEdit class.
I would like to set a predefinite color for my edit block.
When I open the textEdit and I begin to write something, I want to write the characters with a color that is different from zero.
I've tried to insert the following code, in the costructor of the class:
ui->textEdit->setTextColor(Qt::red)
but it doesn't work.
Thanks for the help
The setTextColor you have should work fine - QColor(255,0,0) and Qt::red are the same thing. Tried it and works fine.
OR maybe style sheets would help
qApp->setStyleSheet("QTextEdit { color: red; } ");
https://doc.qt.io/Qt-5/stylesheet-syntax.html

ScrollView in pageView

I have pageView where in the bottom of each page there is a scrollView.
I want that the pageView doesn't turn when the scrollView is scrolling.
My problem is:
when I scroll (in the scrollView) the pages turn with him!
This may not a good practice but it can solve your problem: in Xcode go to your project/ cocos2d_libs.xcodeproject/ extensions/ GUI/ CCScrollView
In CCScrollView.h add:
void mySetSwallowTouch(bool enabled);
In CCScrollView.cpp add:
void ScrollView::mySetSwallowTouch(bool enabled) {
_touchListener->setSwallowTouches(enabled);}
Now call mySetSwallowTouch(true) at your scrollview
scrollview->mySetSwallowTouch(true);
You can also use this with your table view inside a pageView
Since cocos2d-x v3.3 there is already a method void mySetSwallowTouch(bool enabled) available for ListView.
You can simply use it:
ListView* listView = ListView::create();
listView->setSwallowTouches(true);
BTW, I believe swallow touches is currently set to true for ListView by default.

How to hide foundation top bar for large (desktop)?

I am new to foundation. I have a top bar and I want to hide it for desktop because I have another menu for it.
I try to use hide-for-large class, but it didn't work for me.
How can I resolve this?
Try to use .hide-for-medium-up
The class .topbar uses !important on the display property. To override this behaviour, add the following to the bottom of your app.css file or app.scss file. Since its on the bottom of the file, it is given priority.
#media only screen and (min-width: 1440px) {
.topbar {
display:none !important;
}
}
With Foundation if your hide-for-large class isn't working, it could be that you are selectively include components and have not included the visibility classes in your app.scss file #import "foundation/components/visibility"; , you need this for that class to work.

Zurb Foundation 4: remove top-bar fixed/sticky when in mobile?

What would be the best way to keep the "fixed" and/or "sticky" functionality on Zurb Foundation 4's top-bar in desktop views, but remove for mobile views? Having a fixed top bar is great to have on larger devices, but wastes valuable screen real estate on mobile devices.
I'm actually surprised that it doesn't do this by default (or at least have an option to disable on mobile devices).
My quick solution is as follows:
$(function() {
if (Modernizr.mq('only screen and (min-width: 768px)')) {
$('#header').addClass('fixed');
}
});
There's a probably a more elegant solution though (and one that takes care of screen resizing etc.).
EDIT: re-read my question after and realize it was very unclear. Have updated.
You could modify the .fixed class like so:
.fixed {
width: 100%;
position: relative;
#media #{$small} {
position: fixed;
top: 0;
left: 0;
}
}
This will show the navbar as fixed for views larger than mobile, and it should then be free to scroll for mobile.
I'm not sure if it is more elegant but I think I would use .hide-for-small .show-for-small as appears in some elements on the foundation templates, I know that it implies repetition, but hey, it's maybe an opportunity for a more mobile friendly layout for the top-bar. Hope it helps.
Maybe my answer is too obvious, but have you tried on the media query for the mobile devices?
.top-bar {
display: none;
}

Foundation Orbit slider, show nav on small screens

The Orbit slider that comes as part of Zurb's Foundation seems to add a class of hide-for-small to the navigation.
I need the navigation to still show up however in order to show my content. I have tried removing the hide-for-small part of the wrapper in jquery.foundation.orbit.js line 59 but the class keeps getting added.
Does anyone have an idea how to remove it?
You should add .touch .orbit-bullets { display: block; } to your css. Foundation 4 adds the .touch class when using a touch-enabled device, which hides orbit's bullets and arrows.
Better yet, add the following to your app.css to over-ride the class:
.hide-for-small {
display: block !important;
}
It's more future-proof if you upgrade your Foundation someday.
Update: Please see jmsg1990's answer as it is the proper way to do this now.
Just ran into this problem myself and solved it quite easily by opening up jquery.foundation.orbit.js.
At line 60:
directionalNavHTML: '<div class="slider-nav hide-for-small"><span class="right"></span><span class="left"></span></div>'
Simply remove the class "hide-for-small" like below and it works as expected.
directionalNavHTML: '<div class="slider-nav"><span class="right"></span><span class="left"></span></div>'