Introduction Of Use FSCalendar - zhoupIT/ZPTextView GitHub Wiki

###Introduction Of Use FSCalendar

####FSCalendar is an open source iOS calendar control, supporting the transverse and longitudinal sliding mode, full screen mode, with the title, events, setting, and other functions.The following is a screenshot of the project:

iPhone_png iPhone.jpg

iPhone_png iPad.jpg

  • Also can be used as plugin in notification center : notification_png

  • It also can be combined with NCWidgetDisplayMode the new features in iOS10 NCWidgetDisplayMode_png

####Installation CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like FSCalendar in your projects. See the "Getting Started" guide for more information. You can install it with the following command:

####Podfile use_frameworks! pod 'FSCalendar'

	If the project still use Xcode7 and maintain iOS7 support, please add NSCalendarExtension
tothe project.It will insert  high-level API of NSCalendar through the runtime methods, make 	 sure that can also be used in the low version, 	 don't need the  import.

Use_frameworks!It can make CocoaPods use. Frameworks instead of . A static library.Purpose of Using use_frameworks to let the Library Podfile support Interface Builder attribute editor.The diagram below, so that we can in Interface Builder to do some visual FSCalendar property operation, reduce the amount of code in the VC:

FSCalenar.gif

Of course if you want to have a look at the effect before installation, CocoaPods also provides a preview of the instance model, execute code directly:

pod try FSCalendar

####2. Manual installation It is simple to install method Manually, click on the Download in the Zip, then FSCalendar folder in your project, make sure the Copy items if men can be selected 点击download.png

选中Copy items if needed.png Then you can use FSCalendar in the project.

  • There is also a way to install through Carthage, but seemingly fewer people, not repeat them. If you use the project, in the Cartfile to add:

    github "WenchaoD/FSCalendar"

Usage

  1. Not Use Interface Builder

     // ViewController.h
     #import <UIKit/UIKit.h>
     #import "FSCalendar.h"
    
     @interface ViewController : UIViewController <FSCalendarDataSource, FSCalendarDelegate>
    
     @property (weak, nonatomic) FSCalendar *calendar;
    
     @end
     
     // ViewController.m	
     #import "ViewController.h"
    
     @implementation ViewController
    
     - (void)loadView
     {
     	UIView *view = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
     	view.backgroundColor = [UIColor groupTableViewBackgroundColor];
     	self.view = view;
    
     	FSCalendar *calendar = [[FSCalendar alloc] initWithFrame:CGRectMake(0, 64, view.frame.size.width, 300)];
     	calendar.dataSource = self;
     	calendar.delegate = self;
     	calendar.backgroundColor = [UIColor whiteColor];
     	[self.view addSubview:calendar];
     	self.calendar = calendar;
     }
    
     @end
    

effection_png

Here some readers maybe confused do in loadView function, here the explanation for loadView and of viewDidLoad in Apple developer documentation, linking:

loadView.png conclusion

  • If the current VC is not using Interface Builder, please cover this method, if used, it must not override this method, you must not override this method).
  • LoadView this method is responsible for the creation of the root view of the current VC view hierarchy (view hierachy), here for the self. The view assignment (non - nil value), and don't call [super loadView];(Your custom implementation of this method should not call super)
  • ViewDidLoad used for additional initialization (additional initialization).
  1. Use Interface Builder Drag a UIView Object directly, the name of Custom Class is set FSCalendar, then need to create a connection between the FSCalendar dataSource and delegate and VC, as shown in the figure below: Interface Builder_png

Here you will see the effection of rendering for FSCalendar (Carthage does not support this effection temporarily).

	Can also use FSCalendar Swift project, see the SwiftExample project home page.

the home page of github : here