iOS开发问题集合-持续更新
2018-10-15 本文已影响0人
刘明洋
1、打包上传APP到iTunes connect时候出错。
**Invalid Bundle**** - Your app supports Multitasking on iPad, so you must include the UILaunchStoryboardName key in your bundle, 'com.ZhiHuiShiAnBeiJing.PersonalFoodSafety’. Learn more (https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW40).

2 iOS UIScrollView截图,长图截取办法
- (UIImage*)getCapture:(UIScrollView *)scrollView
{
CGPoint savedContentOffset = scrollView.contentOffset;
CGRect savedFrame = scrollView.frame;
scrollView.frame = CGRectMake(0, scrollView.frame.origin.y, scrollView.contentSize.width, scrollView.contentSize.height);
UIGraphicsBeginImageContextWithOptions(scrollView.contentSize, YES, 0.0); //currentView 当前的view 创建一个基于位图的图形上下文并指定大小为
[scrollView.layer renderInContext:UIGraphicsGetCurrentContext()];//renderInContext呈现接受者及其子范围到指定的上下文
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();//返回一个基于当前图形上下文的图片
scrollView.contentOffset = savedContentOffset;
scrollView.frame = savedFrame;
UIGraphicsEndImageContext();
if (image) {
UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), NULL);
}
return image;
}
//回调方法
- (void)image: (UIImage *) image didFinishSavingWithError: (NSError *) error contextInfo: (void *) contextInfo
{
NSString *msg = nil ;
if(error != NULL){
msg = @"保存图片失败" ;
[MBProgressHUD showSAToast:Type_Msg msg:msg];
}
else{
msg = @"保存图片成功" ;
}
}