Author Archive

Restoring inapp purchases in ios

Adding delay between execution of two lines

Incoming search terms:

  • swipe uitableviewcell menu

//for the scrollview set the below property

Incoming search terms:

  • uiscrollview setautoresizessubviews
  • scrollview subview resize

Incoming search terms:

  • ios hide pickerview on didselectrow

Doing Currency Conversion in XCode iPhone

//goto the following link download the DDUnitconverter  folder and copy it into your project

https://github.com/davedelong/DDUnitConverter

float amount =22.0f;

DDUnitConverter *converter = [DDUnitConverter currencyUnitConverter];

NSNumber *nsamount = [NSNumber numberWithFloat:amount];

NSNumber *result =  [converter convertNumber:nsamount fromUnit:DDCurrencyUnitEuro toUnit:DDCurrencyUnitUSDollar];//converts EURO to USD

Performing a background task in iPhone

__block UIBackgroundTaskIdentifier bgTask;

bgTask = [application beginBackgroundTaskWithExpirationHandler:^{

[application endBackgroundTask:bgTask];

bgTask = UIBackgroundTaskInvalid;

}];

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

[self myFunction];//write the block of code for execution here

[application endBackgroundTask:bgTask];

bgTask = UIBackgroundTaskInvalid;

});

Giving gradient color to a UIView in XCode

#import <QuartzCore/QuartzCore.h>//do this import initially

CAGradientLayer *gradient = [CAGradientLayer layer];

gradient.frame = myview.bounds;

gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor colorWithRed:224.0f/255 green:224.0f/255 blue:224.0f/255 alpha:1] CGColor], (id)[[UIColor colorWithRed:192.0f/255 green:192.0f/255 blue:192.0f/255 alpha:1] CGColor], nil];

[myview.layer insertSublayer:gradient atIndex:0];

Incoming search terms:

  • xcode uiview themes

Email validation in XCode

- (BOOL) validateEmail: (NSString *) emailAddress {

NSString *emailRegex = @”[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}”;

NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];

return [emailTest evaluateWithObject:emailAddress];

}

Page 1 of 712345...Last »