借鉴好多,写了个demo
Demo:直接上代码
#import "ViewController.h"
@interface ViewController ()<UIImagePickerControllerDelegate>
{
UIButton *_button;
}
@property (nonatomic, copy) NSString *imagePath;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
/**
* 获取Documents文件夹路径
*
*
*/
// UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
self.view.backgroundColor = [UIColor redColor];
_button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
_button.frame = CGRectMake(100, 100, 100, 100);
[_button setTitle:@"