colored images are not occupying the tabbar item on iPhone6 & 6+ - uitabbarcontroller

I have this code to display colored images in tabbar.
_itemOneNavigationController.tabBarItem.image = [[UIImage imageNamed:#"tabbar-trophy"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
_itemOneNavigationControllerr.tabBarItem.selectedImage = [[UIImage imageNamed:#"tabbar-trophy-selected"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
This works well on iPhone5 & 4. However, on iPhone6 & 6+, images are appearing but do not occupy the entire tabBarItem. They are appearing centered.

Try UITabBarItem setFinishedSelectedImage:withFinishedUnselectedImage:
UIImage *unselected = [[UIImage imageNamed:#"tabbar-trophy"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
UIImage *selected = [[UIImage imageNamed:#"tabbar-trophy-selected"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
[_itemOneNavigationController.tabBarItem setFinishedSelectedImage:selected withFinishedUnselectedImage:unselected];

Related

Tkinter Background not showing transparent

Hey im a newbie in python in my code there is a animated gif that play whenever i run the code. The gif image is actually transparent when open in adobe etc. but the problem is when i run the code.The frame which is the color gray included in the gif.I want to remove the color gray so that the only thing that can see is my only animated gif
This is my code:
# mimic an animated GIF displaying a series of GIFs
# an animated GIF was used to create the series of GIFs
# with a common GIF animator utility
import time
from Tkinter import *
root = Tk()
imagelist = ["dog001.gif","dog002.gif","dog003.gif"]
# extract width and height info
photo = PhotoImage(file=imagelist[0])
width = photo.width()
height = photo.height()
canvas = Canvas(width=width, height=height)
canvas.create_line(0,240,640,240, fill='blue')
canvas.pack()
# create a list of image objects
giflist = []
for imagefile in imagelist:
photo = PhotoImage(file=imagefile)
giflist.append(photo)
# loop through the gif image objects for a while
for k in range(0, 10):
for gif in giflist:
canvas.delete(ALL)
canvas.create_image(width/2.0, height/2.0, image=gif)
canvas.update()
time.sleep(0.1)
root.mainloop()[![enter image description here][1]][1]
dog001.gif
dog002.gif
dog003.gif
As described here, making a Tkinter window transparent is possible, but depends on your OS.
If you are on Windows, just add the following lines after creating the root:
root = Tk()
# Hide the root window drag bar and close button
root.overrideredirect(True)
# Make the root window always on top
root.wm_attributes("-topmost", True)
# Define a transparent color
root.wm_attributes("-transparentcolor", '#eeefff')
Then set your canvas' background color as the transparent color defined above:
canvas = Canvas(width=width, height=height, bg='#eeefff', highlightthickness=0)

Cocos2d-x V3. How to determine admob banner height for different screen sizes?

The rectangle is positioned at y=102.
auto spr = Sprite::create("images/interface/wideBtnBlack.png");
Vec2 origin = Director::getInstance()->getVisibleOrigin();
spr->setColor(Color3B::GREEN);
spr->setPosition(Vec2(origin.x + 200, origin.y + 102));
spr->setAnchorPoint(Vec2::ZERO);
How can I make sure that the rectangle is placed right above the banner for all devices?
You can set Banner Size According to Device. and then By Doing Simple Math You can Achieve what you are Trying to Get. or Use Admob Delegate Method to Get Banner Height.
Banner.Height + (Object.Height/2) = Position Exactly Above Banner.

Loading correctly into a NSBitmapImageRep

I am trying to display an image (with an alpha value) in a window (of size 200X200). The image is loaded into an OpenCV Mat datastructure.
The image I am loading, looks like this:
The image i see when displayed, looks like this:
The code I am using to load the Bitmap is as follows:
NSBitmapImageRep* imageRep = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil
pixelsWide:200
pixelsHigh:200
bitsPerSample:8
samplesPerPixel:4
hasAlpha:YES
isPlanar:NO
colorSpaceName:NSDeviceRGBColorSpace
bytesPerRow:(200*4)
bitsPerPixel:32] autorelease];
memcpy(imageRep.bitmapData,paintBuffer.data,160000);
NSSize imageSize = NSMakeSize(200,200);
NSImage* myImage = [[[NSImage alloc] initWithSize: imageSize] autorelease];
[myImage addRepresentation:imageRep];
g_imageView setImage:myImage];
Update:
I was initially reading BGRA instead of the expected RGBA. On changing that, I just get a red version of image above, like this:

How to create animated canvas using famo.us integrated to angularjs?

So I try to create animation using canvas in famo.us integreted with angularjs.
I found this directive in docs:
<fa-canvas-surface
fa-size="[400,400]"
class="main-canvas"
>
</fa-canvas-surface>
But I have no ideas (or tutorials) how to access it from my controller.js:
mysiteControllers.controller('UvodCtrl', ['$scope','$famous',
function($scope,$famous) {
}]);
or create an animated object (for example this something like: http://jsfiddle.net/7wEWU/46/ ). Do you have any ideas?
You cannot change the size of the surface in runtime, but you can change the size of a modifier.
To animate the canvas you need to place it inside fa-modifier directive and then use Transitionable to animate size change.
Here is the example of animating surface size from 100x100 to 400x400 over 2s:
mysiteControllers.controller('UvodCtrl', ['$scope','$famous',
function($scope,$famous) {
// gets famous Transitionable
var Transitionable = $famous['famous/transitions/Transitionable'];
// sets initial surface size
$scope.surfaceSize = new Transitionable([100, 100]);
// animates surface size change, sets size to 400x400 during 2000ms
$scope.surfaceSize.set([400, 400], {duration: 2000})
}]);
<fa-modifier fa-size="surfaceSize.get()">
<fa-canvas-surface class="main-canvas">
Surface content
</fa-canvas-surface>
</fa-modifier>
Here are the docs on Transitionables: https://famo.us/docs/transitions/Transitionable
And fa-modifier: https://famo.us/integrations/angular/docs/unstable/api/directive/faModifier/
p.s. you can use Transitionable to animate any of the modifier's attributes (fa-rotate, fa-scale, fa-transform, fa-opacity...)

Why is iPhone 5 briefly Letterboxing and displaying Default.png in Cocos2d?

I have Default-568#2x.png which loads fine.
However, (on the actual device) after it shows the iPhone 5 then displays Default.png, in letter box mode. It then loads the 1136 × 640 px Title Screen - which is fine and what it's supposed to do.
I'm using the default Cocos2d HelloWorld template. I haven't changed anything in the plist or otherwise.
Any ideas?
Why does it load the Default.png and how do you fix this?
Thanks.
In the IntroLayer we have
-(void) onEnter
if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ) {
background = [CCSprite spriteWithFile:#"Default.png"];
background.rotation = 90;
}
Which is why Default.png is showing up.
How do you keep showing Default-568h#2x.png if you are using the iPhone 5?
I just added another if statement:
if ([UIScreen mainScreen].bounds.size.height == 568.0) {
background = [CCSprite spriteWithFile:#"Default-568h#2x.png"];
background.rotation = 90;
}