Archive for 'Ios'

We will have to use the batteryMonitoringEnabled property of the device for enabling and disabling battery monitoring using Xcode.

Incoming search terms:

  • objective c enable battery monitoring

How to set a timer method in iOS project?

Create Timer object and allocate it.

NSTimer *timer;

timer = [[NSTimer alloc]init];

Start Timer:

timer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(timerMethod) userInfo:self repeats:YES];

 

Stop Timer:

[timer invalidate];     //TIMER STOPPED

timer = nil;

 

Timer Method:

- (void) timerMethod {

//Do your stuff here..

}

Rolling Rat: Glide with a crazy rat on a crazy wheel

Play Rolling Rat addicting yet simple game. Enjoy the excitement and thrill with blazing balls of fire and speed of gliding. Have fun rolling down a hill with a crazy rat on a crazy wheel. All you have to do is keep the rat rolling, without hitting any obstacles.

Watch out for the vividly illustrated blazing balls of fire that come up to destroy the crazy wheel. To avoid the blazing ball of fire, tap on the screen just in time for the rat on the wheel to jump over the ball of fire to earn you points. At the same time, beware of spiny balls and more tricky obstacles hanging down from the ceiling.

Hitting an obstacle concludes the game. The longer the rat rolls on the crazy wheel, the higher you score. Your best score is showcased.

Enjoy keeping ‘em rolling!!

Download Link – http://bit.ly/11DMXqu

Temple Run 2 now available for iOS devices

The sequel to the smash hit phenomenon that took the world by storm!

With over 170 million downloads, Temple Run redefined mobile gaming. Now get more of the exhilarating running, jumping, turning and sliding you love in Temple Run 2!

Navigate perilous cliffs, zip lines, mines and forests as you try to escape with the cursed idol. How far can you run?!

FEATURES

★ Beautiful new graphics
★ Gorgeous new organic environments
★ New obstacles
★ More powerups
★ More achievements
★ Special powers for each character
★ Bigger monkey!!!

Download Link – http://bit.ly/10ASZsw

Giving gradient color to a UIButton using layers

-(void) addGradient:(UIButton *) _button {

// Add Border
CALayer *layer = _button.layer;
layer.cornerRadius = 8.0f;
layer.masksToBounds = YES;
layer.borderWidth = 1.0f;
layer.borderColor = [UIColor colorWithWhite:0.5f alpha:0.2f].CGColor;

// Add Shine
CAGradientLayer *shineLayer = [CAGradientLayer layer];
shineLayer.frame = layer.bounds;
shineLayer.colors = [NSArray arrayWithObjects:
(id)[UIColor colorWithWhite:1.0f alpha:0.4f].CGColor,
(id)[UIColor colorWithWhite:1.0f alpha:0.2f].CGColor,
(id)[UIColor colorWithWhite:0.75f alpha:0.2f].CGColor,
(id)[UIColor colorWithWhite:0.4f alpha:0.2f].CGColor,
(id)[UIColor colorWithWhite:1.0f alpha:0.4f].CGColor,
nil];
shineLayer.locations = [NSArray arrayWithObjects:
[NSNumber numberWithFloat:0.0f],
[NSNumber numberWithFloat:0.5f],
[NSNumber numberWithFloat:0.5f],
[NSNumber numberWithFloat:0.8f],
[NSNumber numberWithFloat:1.0f],
nil];

[layer addSublayer:shineLayer];
}

iPhone App Development Training in Singapore

Incoming search terms:

  • uibutton shinelayer not appearing

Simple method to query server – HTTP POST

#define DEBUG_URL @”http://yourServer.com/myPHPfile.php?”

Incoming search terms:

  • arduino http post html5

CALayer borders don’t support that behavior. The easiest way to accomplish what you want is adding an n-point-wide opaque subview with your desired border color as its background color on each side of your view.

For example:

Incoming search terms:

  • uiview skip border on one side

How to add multitouch to a single touch app?

By default, multitouch is off in Corona. This means even if there is a touch listener, it will receive only one touch event at a time. So if the user ends up touching the screen then tap a button, or move an object or something nothing happens as touch is already active.

system.activate( “multitouch” ) 

Add this on the beginning of the code. This will generate touch events for each finger touching the screen. Unless the touched area has an active “touch listener”, it should not cause any issue with your existing code and make it more user-friendly.

To disable sleep mode in device

system.setIdleTimer( false )  – disable device sleep mode

Note: It works on both iOS and Android, but not on the simulators. Setting the idle  timer to false keeps the device from going to sleep. Setting it to true enables sleep mode. The default mode if we don’t mention this API is true. Disabling sleep mode would drain out batteries, so use it with caution.

Page 1 of 212