This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
- (void)createEvent { | |
EKEvent *event = [EKEvent eventWithEventStore:self.es];// | |
//可以设置event的相关属性,title表示标题,notes表示备注,-(void)addAlarm:(EKAlarm *)alarm;方法可以添加提醒时间... | |
[self.es saveEvent:event span:EKSpanThisEvent error:nil];//这个时候会生成Event对应的唯一Identifier。 | |
/*EventStore还支持批量写入Event。*/ | |
/*使用-(BOOL)saveEvent:(EKEvent *)event span:(EKSpan)span commit:(BOOL)commit error:(NSError **)erro;方法,commit设为NO*/ | |
/*然后再调用[EKEventStore commit:]一次性提交所有新增*/ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <EventKit/EventKit.h> | |
... | |
- (void)createEKEventStore { | |
EKAuthorizationStatus status = [EKEventStore authorizationStatusForEntityType:EKEntityTypeEvent];//获取日历状态权限 | |
if(status != EKAuthorizationStatusAuthorized) { | |
//没有获取权限则请求权限 | |
self.es = [[EKEventStore alloc] init]; | |
[self.es requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted | |
,NSError * _Nullable error) { | |
if(granted) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "ViewController.h" | |
@interface ViewController () | |
@property (strong, nonatomic) NSMutableArray<NSNumber*> *numbersArray; | |
@end | |
@implementation ViewController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "FunnelChart.h" | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
//初始化数据对象 | |
FunnelChartModel *model1 = [FunnelChartModel new]; | |
model1.value = 10.f; | |
model1.color = [UIColor redColor]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//用了表示是否有异步请求正在执行 | |
@property (assign, atomic) BOOL excuting; | |
@property (strong, nonatomic) NSArray *datasArray; | |
@property (strong, nonatomic) NSOperationQueue *operationQueue; | |
- (void)ViewDidLoad { | |
[super viewDidLoad]; | |
self.excuting = NO; | |
self.operationQueue = [[NSOperationQueue alloc] init]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//仅列出关键代码 | |
@property (strong, nonatomic) NSArarry *datasArray; | |
- (void)beginUploadData { | |
[self uploadDataToServer:self.datasArray[0] index:0]; | |
} | |
- (void)uploadDataToServer:(id)data index:(NSUInteger)index { | |
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//仅展示部分代码 | |
@interface ViewController () | |
/** | |
* 原型cell | |
*/ | |
@property (strong,nonatomic) CustomCell *prototypeCustomCell; | |
/** | |
* 数据源 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)p_updateConstraints{ | |
[self.contentView removeConstraints:self.contentView.constraints]; | |
NSDictionary *views=@{@"contentLabel":self.contentLabel}; | |
NSMutableArray *constraints=[NSMutableArray array]; | |
//设置水平约束 | |
[constraints addObjectsFromArray:[NSLayoutConstraint | |
constraintsWithVisualFormat:@"H:|-5-[contentLabel]-5-|" | |
options:0 | |
metrics:nil | |
views:views]]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)initControls{ | |
_contentLabel=[UILabel new]; | |
_contentLabel.translatesAutoresizingMaskIntoConstraints=NO; | |
_contentLabel.numberOfLines=0; | |
_contentLabel.lineBreakMode=NSLineBreakByWordWrapping; | |
[self.contentView addSubview:_contentLabel]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//... | |
-(void)viewDidLoad{ | |
[super viewDidLoad]; | |
NumberField *numberField=[[NumberField alloc] initWithFrame:CGRectMake(100, 100, 120, 44)]; | |
numberField.placeholder=@"只能输入数字"; | |
//设置精度,长度为10,小数点位数为4的苏子。 | |
numberField.numeric=CGNumeric(10, 4); |
NewerOlder