UIImageView *customImage = [[UIImageView alloc] initWithFrame:CGRectMake(10, 100, 50, 50)];
customImage.backgroundColor = [UIColor blackColor];
customImage.layer.cornerRadius = 25.0f;
customImage.layer.masksToBounds = YES;
[[customImage layer] setBorderWidth:3.0f];
[[customImage layer] setBorderColor:[UIColor whiteColor].CGColor];
[self.view addSubview:customImage];
Load UITableView images in background Asynchronously ?
UIImageView *SponsorLogo = [[UIImageView alloc] initWithFrame:CGRectMake(15, 90, 40, 40)]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^(void) { NSData *data0 = [NSData dataWithContentsOfURL:[NSURL URLWithString:@“your_image_URL_Here”]]; UIImage *image = [UIImage imageWithData:data0]; dispatch_sync(dispatch_get_main_queue(), ^(void) { SponsorLogo.image =...
How to set UIDatePicker date from current date to 10 years ?
datePicker is your UIDatePicker
[NSDate date] is your current date
[datePicker setMinimumDate:[NSDate date]];
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *comps = [NSDateComponents new];
comps.year = 10;
NSDate *tenYears = [calendar dateByAddingComponents:comps toDate:[NSDate date] options:0];
[datePicker setMaximumDate:tenYears];
Add iRates in iPhone/iPad application
1)Download iRate.bundle form Add iRate.bundle, iRate.h, iRate.m Add StoreKit.framework from Build phases 2)#import “iRate.h” in AppDelegate.h/AppDelegate.m 3)AppDelegate.h/AppDelegate.m #pragma mark – delegate methods for iRates – (void)iRateCouldNotConnectToAppStore:(NSError *)error { } – (void)iRateDidDetectAppUpdate { } –...
Convert non ARC files in ARC application and vice versa
1)If your application is ARC (Automatic Reference Counting), and try to use non arc files it will give you error, Then do this – Select Target – > Build phases -> Compile sources Double click on file which you want and write – (-fno-objc-arc) 2)If your application is NonARC, and try to arc files, Then do this – Select Target – > Build phases -> Compile...
UITextfield type email make first letter should be small
try this
UITextField *emailTextField;
emailTextField.autocapitalizationType = UITextAutocapitalizationTypeNone;
if still not working, Go to Device Setting->General->Keyboard->Auto-Capitalization (should be off)
Draw flexible lines on touches Moved in iphone View Based application
// .h ———File CGPoint lastPoint; UIImageView *drawImage; BOOL mouseSwiped; int mouseMoved; //.m ———File – (void)viewDidLoad { [super viewDidLoad]; drawImage = [[UIImageView alloc] initWithImage:nil]; drawImage.frame = self.view.frame; [self.view addSubview:drawImage]; self.view.backgroundColor = [UIColor yellowColor]; } – (void)touchesBegan:(NSSet...
Sort NSMutableArray and Make NSMutableDictionary in iphone
//*******************Code***************** .h NSMutableArray *arrayForLetter; //———————————- .m NSMutableArray *myArray = [[NSMutableArray alloc] init]; [myArray addObject:@”Z”]; [myArray addObject:@”y”]; [myArray addObject:@”X”]; [myArray addObject:@”Z”]; [myArray...
Asynchronous Download images from Url And Save into Documents Directory in iphone
.h//—————————– @interface ViewController : UIViewController { UIActivityIndicatorView *ProccessIndicator; NSMutableArray *imgnmarr,*imgurlarr; } – (void) loadImageInBackground:(NSArray *)urlAndTagReference – (void) assignImageToImageView:(NSArray *)imgAndTagReference ...
Add UIButton on UITableView when drag , Swipe or touches moved on Cell Using UIGestureRecognizerDelegate in iPhone
//——– .h //Delegate UIGestureRecognizerDelegate UIButton *YourButton; //——– .m – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *SimpleTableIdentifier = @”SimpleTableIdentifier”; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SimpleTableIdentifier];...