2016-09-12 24 views
-1

嗨,大家好我是在我的代码中工作fscalandar,现在我想访问fFSCalendarDelegateAppearance方法。一些方法被调用,但大多数方法不起作用。请看看我的代码我在我的代码中使用fscalander,但我无法调用fFSCalendarDelegateAppearance方法

#import <UIKit/UIKit.h> 
    #import <FSCalendar.h> 

    @interface CalTableCellTableViewCell : UITableViewCell <FSCalendarDelegate, FSCalendarDataSource, FSCalendarDelegateAppearance> 

    @property (weak , nonatomic) FSCalendar *calendar; 
    @property (weak, nonatomic) IBOutlet NSLayoutConstraint *calendarHeightConstraint; 

    @property (weak, nonatomic) IBOutlet UIView *calview; 
    @property (strong, nonatomic) NSDate *selectedDate; 

    @property (strong, nonatomic) NSDictionary *fillSelectionColors; 
@property (strong, nonatomic) NSDictionary *fillDefaultColors; 
@property (strong, nonatomic) NSDictionary *borderDefaultColors; 
    @property (strong, nonatomic) NSDictionary *borderSelectionColors0; 

    @property (strong, nonatomic) NSArray *datesWithEvent; 
@property (strong, nonatomic) NSArray *datesWithMultipleEvents; 


    @end 

,这里是.m文件

@implementation CalTableCellTableViewCell 

    - (void)awakeFromNib { 
     [super awakeFromNib]; 
     // Initialization code 


    FSCalendar *calendar = [[FSCalendar alloc] initWithFrame:CGRectMake(0, 0, 250, 150)]; 
    calendar.dataSource = self; 
    calendar.delegate = self; 
     [self.contentView addSubview:calendar]; 
    self.calendar = calendar; 

_calendar.scrollDirection = FSCalendarScrollDirectionVertical; 

NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; 
formatter.dateFormat = @"d.M.yyyy"; 
NSString *string = [formatter stringFromDate:[NSDate date]]; 

NSLog(@"current date %@", string); 
_calendar.appearance.selectionColor = [UIColor blueColor]; 

_calendar.appearance.todayColor = [UIColor greenColor]; 
_calendar.appearance.cellShape = FSCalendarCellStyleRectangle; 

    } 

    - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 
[super setSelected:selected animated:animated]; 

// Configure the view for the selected state 
    } 





    - (void)calendar:(FSCalendar *)calendar boundingRectWillChange:(CGRect)bounds animated:(BOOL)animated 
    { 
_calendarHeightConstraint.constant = CGRectGetHeight(bounds); 
[self.contentView layoutIfNeeded]; 
    } 

    - (NSDate *)minimumDateForCalendar:(FSCalendar *)calendar 
    { 
return [calendar dateWithYear:2016 month:5 day:1]; 

    _calendar.appearance.todayColor = [UIColor greenColor]; 

    } 

    - (NSDate *)maximumDateForCalendar:(FSCalendar *)calendar 
    { 
return [calendar dateWithYear:2017 month:5 day:31]; 


    } 

     #pragma mark - <FSCalendarDelegateAppearance> 


    - (UIColor *)calendar:(FSCalendar *)calendar appearance:(FSCalendarAppearance *)appearance eventColorForDate:(NSDate *)date 
    { 
NSString *dateString = [calendar stringFromDate:date format:@"yyyy-MM-dd"]; 
if ([_datesWithEvent containsObject:dateString]) { 
    return [UIColor purpleColor]; 
} 
return nil; 
    } 

    - (NSArray *)calendar:(FSCalendar *)calendar appearance:(FSCalendarAppearance *)appearance eventColorsForDate:(NSDate *)date 
    { 
NSString *dateString = [calendar stringFromDate:date format:@"yyyy-MM-dd"]; 
if ([_datesWithMultipleEvents containsObject:dateString]) { 
    return @[[UIColor magentaColor],appearance.eventDefaultColor,[UIColor blackColor]]; 
} 
return nil; 
    } 

回答

2

我想你忘记设置的

Calender.delegateAppearance = self; 
+0

委托喔那是我的兄弟 –

+0

先生在FSCalander类型的对象上找不到错误delegateAppearance –

+0

@SandeepChaudhary - 检查委托 –

相关问题