IOS 日歷組件,帶農歷顯示:WHUCalendar

jopen 10年前發布 | 31K 次閱讀 iOS開發 移動開發 WHUCalendar

image

日歷組件,支持農歷顯示,操作流暢


  1. 支持IOS7+
  2. 支持xib
  3. 支持農歷

用法:


  1. 直接在xib中設置UIView的類為WHUCalendarView

  2. 代碼使用WHUCalendarView:

  WHUCalendarView* cview=[[WHUCalendarView alloc] init];
    CGSize s=[cview sizeThatFits:CGSizeMake(300, FLT_MAX)];
    cview.frame=CGRectMake(0, 0, s.width, s.height);
    cview.onDateSelectBlk=^(NSDate* date){
        NSDateFormatter *format = [[NSDateFormatter alloc] init];
        [format setDateFormat:@"yyyy年MM月dd"];
        NSString *dateString = [format stringFromDate:date];
        NSLog(@"%@",dateString);
   };

3.提供了類WHUCalendarPopView用于彈出選擇:

@interface ViewController ()
{
    WHUCalendarPopView* _pop;
}
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _pop=[[WHUCalendarPopView alloc] init];
    _pop.onDateSelectBlk=^(NSDate* date){
        NSDateFormatter *format = [[NSDateFormatter alloc] init];
        [format setDateFormat:@"yyyy年MM月dd"];
        NSString *dateString = [format stringFromDate:date];
        NSLog(@"%@",dateString);
   };
}
- (IBAction)onBtnClick:(id)sender {
    [_pop show];
}

項目主頁:http://www.baiduhome.net/lib/view/home/1447310694835

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!