Nitin Gaikwad
Wednesday, September 19, 2012
Add days to NSDate
for (int i = 1; i < 30; i++) {
NSDate *newDate = [startDay.date dateByAddingTimeInterval:60*60*24*i];
MDay *day = [[MDay alloc] init];
day.date = newDate;
[list addObject:day];
}
Disable Auto sleeping
[UIApplication sharedApplication].idleTimerDisabled = YES;
Hide navigation bar for navigation controller
Add this line in the view did load method
[self navigationController].navigationBarHidden = YES;
Download UIImage Url
NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://chart.apis.google.com/chart?cht=qr&chs=350x350&chl=nitin"]];
UIImage *myImage = [UIImage imageWithData:imageData];
Saturday, September 15, 2012
NSDateFormater
-(NSString *)getDate:(NSDate *)date{
if (!dateFormatter) {
dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"dd-MMM-yyyy"];
//Her we give the different type of date format e.g. “dd-MM”,” dd-MMM-yyyy”,” dd-MMM-yyyy MM:HH”
}
return [[dateFormatter stringFromDate:date] uppercaseString];
}
Create CustomBack Button in Navigation Controller
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"MybackBtn" style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.backBarButtonItem = backButton;
Older Posts
Home
Subscribe to:
Posts (Atom)