iOS一句代码调用系统日历

作者: Double丶K | 来源:发表于2016-07-28 10:27 被阅读1476次

给图片添加一个手势

calenDarView1 = [[UIImageView alloc]initWithFrame:CGRectMake(ScreenWidth/12, CGRectGetMaxY(lineBacView.frame)+15, ScreenWidth/6, ScreenWidth/5)];
calenDarView1.image = [UIImage imageNamed:@"xxx.png"];
 [self.view addSubview:calenDarView1];
calenDarView1.userInteractionEnabled = YES;
    UITapGestureRecognizer * PrivateLetterTap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAvatarView:)];
    PrivateLetterTap.numberOfTouchesRequired = 1; //手指数
    PrivateLetterTap.numberOfTapsRequired = 1; //tap次数
    PrivateLetterTap.delegate= self;
    calenDarView1.contentMode = UIViewContentModeScaleToFill;
    [calenDarView1 addGestureRecognizer:PrivateLetterTap];

手势方法里面写调用日历的方法

- (void)tapAvatarView: (UITapGestureRecognizer *)gesture
{
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"calshow:"]];
}

相关文章

网友评论

    本文标题:iOS一句代码调用系统日历

    本文链接:https://www.haomeiwen.com/subject/btrajttx.html