Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TitleDefaultColorForDate Delegate Quickly called before web service Implementing and Want to Change colors for the dates from array? #409

Closed
saravanaPluggdd opened this issue Sep 3, 2016 · 1 comment

Comments

@saravanaPluggdd
Copy link

saravanaPluggdd commented Sep 3, 2016

How to Implement the followed delegate function after the web service called and want to change the colors for some of the dates from array, After slide the calendar only the color is changed but I want to Change the color of dates and calendar launching, It is possible or not?

The Delegate Function is:

`- (UIColor *)calendar:(FSCalendar *)calendar appearance:(FSCalendarAppearance *)appearance titleDefaultColorForDate:(NSDate *)date
{
NSString *dateString = [calendar stringFromDate:date format:@"yyyy-MM-dd"];
if ([response containsObject:dateString])
{
return [UIColor colorWithRed:59.0/255.0f green:179.0/255.0f
blue:195.0/255.0f alpha:1.0];
}
return nil;
}

`
The Json Parsing Web Service is Following.

`-(void)getdates
{
startBuddyStr = @"19";

NSString *changeDateStr = [_calendar stringFromDate:_calendar.currentPage format:@"dd"];
NSLog(@"changed Date is %@",changeDateStr);

NSString *changeMonthStr = [_calendar stringFromDate:_calendar.currentPage format:@"MM"];
NSLog(@"changed Month is %@",changeMonthStr);

NSString *changeYearStr = [_calendar stringFromDate:_calendar.currentPage format:@"yyyy"];
NSLog(@"changed Year is %@",changeYearStr);

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
manager.responseSerializer.acceptableContentTypes = [manager.responseSerializer.acceptableContentTypes setByAddingObject:@"text/html"];


NSDictionary *parameters = @{@"buddyid":startBuddyStr,@"month":changeMonthStr,@"year":changeYearStr};

[manager POST:@"http:www.url/opendates.php" parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {

    jsonObject=[NSJSONSerialization
                JSONObjectWithData:responseObject
                options:NSJSONReadingMutableLeaves
                error:nil];
    NSLog(@"JSON is %@",jsonObject);
    response = [[jsonObject objectForKey:@"opendates"] valueForKey:@"datevalue"];
    NSLog(@"response is %@",response);


}
      failure:^(AFHTTPRequestOperation *operation, NSError *error) {

          NSLog(@"Error: %@", error);
      }];

}
`

@WenchaoD
Copy link
Owner

WenchaoD commented Sep 5, 2016

@saravanaPluggdd To perform a reloading , just call [calendar reloadData];.
And I'm sorry that I didn't quite get the rest of your question.

@WenchaoD WenchaoD closed this as completed Sep 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants