iOS 相册没有返回按钮

最近某些机型会偶尔出现调用相册,没有返回按钮的问题,解决方案(自己写一个按钮):

[_sourceVC presentViewController:picker animated:YES completion:^{
        UIViewController *vc = picker.viewControllers.lastObject;
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
        btn.frame = CGRectMake(0, 0, 35, 33);
        [btn setTitle:@"取消" forState:UIControlStateNormal];
        btn.titleLabel.font = [UIFont systemFontOfSize:17];
        [btn addTarget:self action:@selector(cancleClick) forControlEvents:UIControlEventTouchUpInside];
        [btn setTitleColor:[UIColor colorWithHexString:@"#287fec"] forState:UIControlStateNormal];//colorWithHexString自定义方法,请忽略
        vc.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
    }];

这里的重点是这个颜色值 #287fec,这是UI帮忙吸出来的原本那个取消按钮的蓝色颜色值(苹果系统按钮都是这个蓝色),可能有些不准确,但是我这个渣渣肉眼是看不出来。

猜你喜欢

转载自blog.csdn.net/qq_28285625/article/details/103785910