|
1 2 3 4 |
-(IBAction)inAppRestoreButAxn:(id)sender { [[SKPaymentQueue defaultQueue] restoreCompletedTransactions]; } |
Author Archive
Restoring inapp purchases in ios
Adding delay between execution of two lines
|
1 2 3 4 5 |
double delayInSeconds = 2.0; dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ NSLog(@"Do some work"); }); |
iPhone scroll UITableview by swiping another view
|
1 2 3 |
UISwipeGestureRecognizer * swipegesture = [[UISwipeGestureRecognizer alloc]init]; swipegesture =[myTableview.gestureRecognizers objectAtIndex:1]; [myView addGestureRecognizer:swipegesture];//myView is the another view |
Incoming search terms:
- swipe uitableviewcell menu
Autoresize components horizontally in UIScrollView in ios
//for the scrollview set the below property
|
1 2 3 |
[scrollview setAutoresizesSubviews:YES]; //then for every subview of the scrollview set the below property [subview setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; |
Incoming search terms:
- uiscrollview setautoresizessubviews
- scrollview subview resize
How to implement transitions between views via a UIPickerView in iOS application
|
1 2 3 4 5 6 7 |
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent: (NSInteger)component { //in this method hide the views that you don't want to show and show the views that you don't want to hide, when a particular row is selected. NSLog(@"row selected----->>%d",row); } |
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;
});
AutoResizing components width in a UIScrollview in iPhone XCode
|
1 2 3 |
<code> [scrollview setAutoresizesSubviews:YES]; //then for every subview of the scrollview, set the below property [subview setAutoresizingMask:UIViewAutoresizingFlexibleWidth];</code> |
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];
}



