我的第一篇MarkDown博客
单线程男孩儿
- iOS截屏效果
/**
*截图功能
*/
-(void)screenShot
{
UIGraphicsBeginImageContextWithOptions(CGSizeMake(640, 960), YES, 0);
//设置截屏大小
[[self.view layer] renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
CGImageRef imageRef = viewImage.CGImage;
CGRect rect = CGRectMake(0, 0, 641, SCREEN_HEIGHT + 300);//这里可以设置想要截图的区域
CGImageRef imageRefRect =CGImageCreateWithImageInRect(imageRef, rect);
UIImage *sendImage = [[UIImage alloc] initWithCGImage:imageRefRect];
//以下为图片保存代码
UIImageWriteToSavedPhotosAlbum(sendImage, nil, nil, nil);//保存图片到照片库
NSData *imageViewData = UIImagePNGRepresentation(sendImage);
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *pictureName= @"screenShow.png";
NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:pictureName];
[imageViewData writeToFile:savedImagePath atomically:YES];//保存照片到沙盒目录
CGImageRelease(imageRefRect);
//从手机本地加载图片
UIImage *bgImage2 = [[UIImage alloc]initWithContentsOfFile:savedImagePath];
}
离线写博客
即使用户在没有网络的情况下,也可以通过本编辑器离线写博客(直接在曾经使用过的浏览器中输入write.blog.csdn.net/mdeditor即可。Markdown编辑器使用浏览器离线存储将内容保存在本地。
用户写博客的过程中,内容实时保存在浏览器缓存中,在用户关闭浏览器或者其它异常情况下,内容不会丢失。用户再次打开浏览器时,会显示上次用户正在编辑的没有发表的内容。
博客发表后,本地缓存将被删除。
用户可以选择 把正在写的博客保存到服务器草稿箱,即使换浏览器或者清除缓存,内容也不会丢失。
注意:虽然浏览器存储大部分时候都比较可靠,但为了您的数据安全,在联网后,请务必及时发表或者保存到服务器草稿箱。
浏览器兼容
- 目前,本编辑器对Chrome浏览器支持最为完整。建议大家使用较新版本的Chrome。