Skip to main content

Posts

Showing posts with the label background

iPhone - Setting background on UITableView

Is there any way to set a background view on a UITableViewController? I try with the code I am using on a UIViewController, but the view comes over all the contents of the table view, and if I add the background view in the cellForRowAtIndexPath-method, it is not showing at all. Anyone done this before or have an idea on how it can be done? Here is the code I am using: UIImage *image = [UIImage imageNamed: @"background.jpg"]; UIImageView *backImage = [[UIImageView alloc] initWithImage: image]; [self.view addSubview: backImage]; [self.view sendSubviewToBack: backImage]; Thanks Source: Tips4all

Cocos2d adding a background image to a layer?

I just finished reading some of the cocos2d documentation, and as far as I understand to add a background image to a layer you have to do something like: Sprite * bg = [Sprite spriteWithFile:@"Background.png"]; [layer addChild:bg z:0]; Allthough as far as my testing goes you can just directly add the sprite to the scene like this: @implementation IntroScene - (id) init { self = [super init]; if (self != nil) { Sprite * bg = [Sprite spriteWithFile:@"Background.png"]; [bg setPosition:ccp(240, 160)]; [self addChild:bg z:0]; [self addChild:[MenuLayer node] z:1]; } return self; } What is the difference between this 2 options, and what is the better way to set a background for a layer?. Any help will be greatly appreciated.

iOS app: Uploading multiple files in the background

For iOS, I am aware that apps can upload in the background, as according to this thread: Uploading in background thread in iOS When I refer to "background", I mean the user has clicked the home button, using another app, or the phone's screen is off. Follow-up Questions: 1. Is there a timeout limit to the background uploading? This may be an issue if the file being uploaded is huge. 2. Is it possible to upload a list of files in the background, or does it only support the finishing of one upload that was in progress before the user switched to another app? 3. I suppose if the user quits the app completely, the upload will be stopped? Quitting completely as in, user double clicks home button, touches and holds down on the app until it starts shaking, then clicks the "X" to shut it down.

Android - Running heavy computations in background and returning the result to an Activity

I have implemented some computationaly heavy functions into my application. Depending on the type of input it can take up to several minutes for a thread to return. During this time, I want the user to be able to work with other activities to perform different tasks (i.e. prepare data for the next run). Then, after the Service has finished it's computations, the user should be notified with a Toast that the result is ready and that he should check back to the Activity he started the Service in. Unfortunately I'm stuck at this point. Is it possible to somehow communicate with an Activity which is destroyed at the moment? Like modifying the saved state, so that when it get's recreated the result will be displayed. The only way of communication I did find was via broadcasting from the Service, but this requires the Activity to listen, which is not possible as it doesn't exist at the moment the Service finishes. The only solution that occured to me was writing a file

Custom "animate” jQuery function. How to reset step"s "now” variable?

I need to animate the background-position property of an element with jQuery. By following this tutorial, that uses default jQuery animate function, I had no luck. http://snook.ca/archives/javascript/jquery-bg-image-animations My function was like: $('#content').css( {backgroundPosition: "0 0"} ) .animate( {backgroundPosition:"(0 -900px)"}, {duration:500} ); I had no luck with it, so I tried to code my own function, that changes the vertical background position of an element. It looks like: $.fn.moveBackgroundY = function( pixels, duration, easing ) { return this.animate( { pixels: pixels }, { step: function(now,fx) { console.log("Background Y position - " + now); $(this).css({ backgroundPosition: '0px ' + now + 'px',