草庐IT

到另一个uiimage

在我的项目中,我有两个UIViewControllers。在我的第一个ViewController上,我有一个UIImageView并且有一个来自url。在第二个ViewController上,我有一个空的UIImageView.当用户点击图像中时UIImageView在第一个ViewController,第二个图像ViewController(以前是空的)应该像第一个单击的单击一样ViewController.有可能吗?图像来自url(就像我之前写的那样),所以我认为它应该起作用,但是我不知道该怎么做。看答案创建一个静态属性UIImage在firstVCstaticvarimageFromU

php - 使用 PHP 和 jSON 从 MySQL 获取 UIImage

我正在开发一个小型新闻阅读器,它通过对URL执行POST请求来从网站检索信息。响应是一个带有未读新闻的jSON对象。例如App上的最新消息的时间戳为“2013-03-01”。当用户刷新表格时,它会发布“domain.com/api/api.php?newer-than=2013-03-01”。api.php脚本进入MySQL数据库并获取2013-03-01之后发布的所有新闻并打印它们json_encoded。这是//dosomethingtogetthedatainanarrayecho$array_of_fetched_data;例如,响应将是[{"title":"newappisc

iphone - iOS :Get UIImage Orientation inside a UIImageview with exif data?

我正在旋转UIImageview和其中的UIImage。我想在旋转UIImageview后获取UIImage的方向。 最佳答案 您可以使用myImage.imageOrientation,这将为您提供UIImageOrientation。或如果你使用了UIImagePickerViewController然后使用它的委托(delegate)方法"imagePickerController:didFinishPickingMediaWithInfo:"在此方法中,您还可以访问信息字典NSlog(@"%d",[infoobjectFor

ios - 绘制时对 UIImage 应用变换

尝试将可以缩放或旋转的较小图像叠加到较大图像上:+(UIImage*)addToImage:(UIImage*)baseImagenewImage:(UIImage*)newImageatPoint:(CGPoint)pointtransform:(CGAffineTransform)transform{UIGraphicsBeginImageContext(baseImage.size);[baseImagedrawInRect:CGRectMake(0,0,baseImage.size.width,baseImage.size.height)];[newImagedrawAtPoi

ios - UIImage imageWithContentsOfFile 正确的pathForResource

我有资源:Test.pngtest1.jpgtesT2.jpgtEst3.jpg我需要在UIImageView中显示此图像。所以我写道:imgView.image=[UIImageimageWithContentsOfFile:[[NSBundlemainBundle]pathForResource:[myObject.filenamestringByDeletingPathExtension]ofType:[myObject.filenamepathExtension]]];myObject是我模型中的实体。我从xml中获取filename,但在xml中它的格式如下:filename

php - 比较 iPhone 上 UIImage 上的 MD5 哈希和服务器上的文件

我正在尝试在iOS应用程序中计算MD5哈希值,以便比较应用程序中保存的文件与使用PHP存储在网络服务器上的相同文件之间的哈希值。这是iOS应用程序的代码:unsignedcharresult[CC_MD5_DIGEST_LENGTH];NSData*data=[NSDatadataWithContentsOfFile:@"advert.png"];constvoid*src=[databytes];CC_MD5(src,[datalength],result);NSString*imageHash=[[NSStringstringWithFormat:@"%02X%02X%02X%02

objective-c - 如果不在主线程上使用,则 renderincontext 内存泄漏

我正在尝试使用以下代码将我的UIView转换为UIImage。+(UIImage*)imageWithView:(UIView*)view{floatscale=1.0f;UIGraphicsBeginImageContextWithOptions(view.bounds.size,YES,scale);[view.layerrenderInContext:UIGraphicsGetCurrentContext()];UIImage*img=UIGraphicsGetImageFromCurrentImageContext();UIGraphicsEndImageContext();v

iOS UIScrollView 性能

我正在尝试提高我的UIScrollView的滚动性能。我上面有很多UIButtons(它们可能有数百个):每个按钮都有一个png图像设置为背景。如果我在整个卷轴出现时尝试加载它,会花费太多时间。在网络上搜索后,我找到了优化它的方法(在滚动时加载和卸载页面),但每次我必须加载新页面时,滚动都会有一点停顿。您有什么建议可以让它平滑滚动吗?你可以在下面找到我的代码。-(void)scrollViewDidScroll:(UIScrollView*)tmpScrollView{CGPointoffset=tmpScrollView.contentOffset;//322istheheighto

ios - 将 UIImage 转换为 NSData 并将 NSData 转换为 NSString 以将图像发布到服务器

我有两个UIImageView。我想通过脚本将两个图像发布到服务器。在此之前,我必须将这些图像转换为数据并将数据转换为字符串,但我不知道如何将图像从UIImageView转换为NSData和NSData到NSString。我已经引用了所有代码,但它不起作用。我还想知道在我的代码中应该在哪里声明转换编码(图像到数据和数据到图像)?这是我实现的.h部分#import#import"GlobalAccessClass.h"#import@interfaceAskQuestionHome:UIViewController{}@property(strong,nonatomic)IBOutlet

ios - 拍摄照片并将其保存到相机胶卷

我遇到了一个问题,我只想要一个简单的解决方案来拍照,然后将其保存在我的应用程序中。然而到目前为止,我所能做的就是拍摄照片并将其加载到UIImageView中,但它不会保存在相机胶卷中。-(IBAction)takePhoto:(UIButton*)sender{UIImagePickerController*picker=[[UIImagePickerControlleralloc]init];picker.delegate=self;picker.allowsEditing=YES;picker.sourceType=UIImagePickerControllerSourceType