Splash screen fade-out in titanium - titanium

I want to fade out the splash screen.
I think it's possible in native code android or iOS.
However for titanium which way is the appropriate ??
for now my source code is this
var topWin = Ti.UI.createWindow();// main application window.
var img = Ti.UI.createImageView({
image : '/img/Default.png',
top : 0,
left : 0,
width : '100%',
height : '100%'
});
var splash = Ti.UI.createWindow(); //splash window
splash.add(img);
splash.open();
var fadeOut = Ti.UI.createAnimation({
opacity : 0.2,
duration : 300
});
var fadeIn = Ti.UI.createAnimation({
opacity : 1,
duration : 1800
});
setTimeout(function(e) {
splash.close(fadeOut);
topWin.open(fadeIn);
}, 3000);
It works as I mean however I think this way might be a bit strange.
Since
I have to decide the each image according to different resolution devices(iphone/ipad/android ,,) by manual while splash screen is chosen automatically.
Is there a good way other than this??

Take a look at this:
http://www.tidev.io/2015/01/06/how-to-re-use-the-launch-image-in-the-app/
I haven't done this in a while, and I'm not sure if the changes to 5.2 SDK for iOS for Storyboard launch files breaks this method but here's where I'd start.

Related

Setting UI Button width and height in cocos2d js android application

In my Cocos2d js android app i have a UI button as
var button=new ccui.Button();
button.loadTextures(res.play_png,res.play_png);
button.setAnchorPoint(cc.p(0,0));
button.x=size.width/2;
button.y=size.height/2;
this.addChild(button);
The button loads and i am able to set it at any position on the screen.
But i am unable to change its width and height to specified number of pixels.
I want something like
button.width=100;
button.height=100;
I did not find any method to do that...
Any help how to accomplish this would be greatful.
Thanks.
The buttons i use are options like play,how to play,share etc..
So i have to position them in such a way that they dont overlap or get distorted for various screen resolutions...
How can i use the setScale method in this context???
We can make a call to a function that can scale the size of the UIButton by performing an action. In this case, the following code might help:
performScaleAction : function()
{
var duration = 0; // duration in seconds for performing this action
var scaleX = 0.5; // scale factor for X-axis
var scaleY = 0.5; // scale factor for Y-axis
var scaleAction = new cc.ScaleTo(duration , scaleX , scaleY );
this.runAction(scaleAction);
}
Now, call the above function in the following way:
this.performScaleAction();
this.addChild(button);
So, if the actual height of the image used for creating the UIButton is h, in this case, the new size as displayed on the screen would be h times scaleX . Same for the width of the UIButton.
Hope this helps!

Image loading problems in titanium appcelerator

I am developing a image gallery application using titanium android. The image view is used to view the images. But my problem is first time the images load properly. When I am using the app long time the the app use more cache memory as well as the image is not loading. The code is below
var SelfieImageView = Ti.UI.createImageView({
width : '100%',
height : Ti.UI.SIZE,
image : 'http://mydomain.com/image1.png' ,
defaultImage : '/images/Default-Back-Ground--Advertisements.png',
bottom : 3,
Index : FollowingFeedStartIndex,
});

dojo splitter not resizing properly with dynamic content

I'm creating a seemingly simple dojo 1.8 web page which contains an app layout div containing a tab container and an alarm panel below the tab container. They are separated by a splitter so the user can select how much of the alarms or the tabcontainer they want to see.
Here's the example on jsfiddle:
http://jsfiddle.net/bfW7u/
For the purpose of the demo, there's a timer which grows the table in the alarm panel by an entry every 2 seconds.
The problem(s):
If one doesn't do anything and just lets the table grow, no scroll bar appears in the alarm panel.
If one moves the splitter without having resized the browser window first, the splitter handle ends up in a weird location.
Resizing the browser window makes it behave like I would expect it to begin with.
Questions:
Am I doing something wrong in the way I'm setting things up and that's causing this problem?
How can I catch the splitter has been moved event (name?)
How do I resize the splitter pane to an arbitrary height? I've tried using domStyle.set("alarmPanel", "height", 300) and this indeed sets the height property... but the pane does not resize!
Any help greatly appreciated!
I forked your jsFiddle and made some modifications to it: http://jsfiddle.net/phusick/f7qL6/
Get rid of overflow: hidden in html, body and explicitly set height of alarmPanel:
.claro .demoLayout .edgePanel {
height: 150px;
}
This tricky one. You have two options: to listen to splitter's drag and drop or to listen to ContentPane.resize method invocation. Both via dojo/aspect:
// Drag and Drop
var splitter = registry.byId("appLayout").getSplitter("bottom");
var moveHandle = null;
aspect.after(splitter, "_startDrag", function() {
moveHandle = aspect.after(splitter.domNode, "onmousemove", function() {
var coords = {
x: !splitter.horizontal ? splitter.domNode.style.left : 0,
y: splitter.horizontal ? splitter.domNode.style.top : 0
}
dom.byId("dndOutput").textContent = JSON.stringify(coords);
})
});
aspect.after(splitter, "_stopDrag", function() {
moveHandle && moveHandle.remove();
});
// ContentPane.resize()
aspect.after(registry.byId("alarmPanel"), "resize", function(duno, size) {
dom.byId("resizeOutput").textContent = JSON.stringify(size);
});
Call layout() method after changing the size:
registry.byId("alarmPanel").domNode.style.height = "200px";
registry.byId("appLayout").layout();

Titanium : Android Ti.UI.currentWindow is not working for Tab Group

Am using Tab group and using 4 tabs, 4 different windows are added to the tabs. when i try to get current window , by Ti.UI.currentWindow in any of the views which is added to windows, am getting blank value, that is it is not returning, current window value.
Can anyone correct me??
you set "url" property in Window on creation time. Like
in "app.js"
var tabGroup = Titanium.UI.createTabGroup();
var win_home = Titanium.UI.createWindow({
url :'home.js',
backgroundColor :'#000',
backgroundImage :'image/bg_img1.png',
barColor : "#000000",//"#ff429c"
});
var tab_home = Titanium.UI.createTab({
index : 0,
window:win_home
});
tabGroup.addTab(tab_home);
tabGroup.open();
in "home.js"
var cur = Ti.UI.currentWindow;
var view = Ti.UI.createView({
height : 100,
width : 100,
backgroundColor : "#0f0",
});
cur.add(view);
Understand this code and try to make like this. this is truly working... cheers...

Stop Scrolling after a certain scroll in scrollview - Titanium

I am just developing a Titanium App. I want to disable scrolling of a scrollView after some scrolling . In other words I want the scroll to stop at a certain position of my screen. Suppose I want the below scrollView to stop scrolling after it scroll a height of 200px. How can I do this?
var containerScroll = Ti.UI.createScrollView({
backgroundColor : 'transparent',
opacity : 0.0,
showVerticalScrollIndicator : true,
showHorizontalScrollIndicator : false,
});
Thanks
It appears this would be your answer, but it is iOS specific. Set the 'scrollingEnabled : false' property. I wasn't able to find an Android version for you.
var scrollableView = Ti.UI.createScrollableView({
views:[new generateVerifyView(),new generateUserView(),new generateAddrView()],
showPagingControl : false,
scrollingEnabled : false
});
http://developer.appcelerator.com/question/122741/disable-scrolling-in-a-scrollableview
YOu try about
scrollview.contentOffset="200";
this is working for me ...