Tag: 图像

将从AppDelegate的推送通知接收到的数据传递给ViewController

在我的应用程序中,有一个集合视图,显示从Web服务检索到的一组图像。 每个图像都有标签。 所以应用程序也有能力使用标签过滤图像。 现在我试图添加推送通知到这个应用程序。 将新图像添加到服务器时,会发送推送通知。 这些图像被标记为最新的 。 我通过推送通知传递该标记作为消息,我需要的是当用户点击推送通知打开应用程序,它应该加载最新的新图像集合视图。 我完成了一半。 我收到消息成功的推送通知到AppDelegate.m文件中的AppDelegate.m方法。 现在我需要将它传递到集合视图所在的视图控制器。 我被困在这一点上。 我不知道如何将其发送到视图控制器。 我试着在App委托中声明一个属性,给它分配消息值,并从视图控制器中引用它,但是它不起作用。 我绑定代表,通知中心,用户默认,但没有任何工作。 任何人都可以请告诉我如何做到这一点? 谢谢。 编辑: 这是我的代码。 我尝试的最后一个方法是本地通知。 AppDelegate.m – (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { [[NSNotificationCenter defaultCenter] postNotificationName:@"PushNotificationMessageReceivedNotification" object:nil userInfo:userInfo]; } ViewController.m – (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(remoteNotificationReceived:) name:@"PushNotificationMessageReceivedNotification" object:nil]; } – (void)remoteNotificationReceived:(NSNotification *)notification { NSLog(@"Notification: %@", notification.userInfo); NSString *msg […]

如何读取iPhone上的RGB像素数据

我想知道如何在iPhone上扫描图像并分析每个像素的RGB值,从而最终确定整个图像的平均RGB值。 如果有人能把我推向正确的方向,将不胜感激。 我是图像分析新手,不确定从哪里开始,或者iOS 5 API中是否包含这样的内容。

通过PhoneGap在iOS中保存PNG或JPG图片到照片

我是PhoneGap的新手,想知道如何在iOS中将照片保存到照片。 虽然我能够使用 navigator.camera.getPicture 与选项 quality:50, destinationType:Camera.DestinationType.DATA_URL,saveToPhotoAlbum: true 要将照相机拍摄的照片保存到照片中,我现在正在尝试了解如何将照片保存为应用内图像。 考虑下面的PhoneGap – cordova页面元素myPhoto举行像datadata,如“data:image / jpeg; base64,”… <html> <head> <title>Save Image</title> <script type="text/javascript" charset="utf-8" src="cordova-2.1.0.js"></script> <script type="text/javascript" charset="utf-8"> function savePicture(){ //this is where the magic would happen //how can I save myPhoto to Photos? //output imageData to a jpg or png file which would show up in Photos? […]

删除图像中的Alpha通道

我有一个适用于iOS的应用程序图标,但苹果不允许在图像中使用Alpha。 如何删除这个alpha通道? 我只有我的PNG图像我没有源文件,因为我的朋友做了我的形象。

图像大小和移动设备和dpi

这是关于移动设备的图像及其尺寸的问题。 所以假设我想要一个完整的手机屏幕图像。 我假设屏幕是320 * 480在这里,这似乎一致。 当我在Photoshop或MS Paint中制作图像时,我可以select像素/英寸(好吧,也许不是在绘画中,但是我会漂移)。 默认值为72像素/英寸,是否始终保持这种状态? 有些设备有更高的dpi – 我认为“默认”是160 dpi – 所以对于240dpi的设备来说,我可以显示相同的图像: 将图像从320 * 480缩放到480 * 640(即size = oldSize * 240/160) 转到我的图像,并将像素/英寸更改为72 * 240/160? 鉴于Android的大小如此: xlarge screens are at least 960dp x 720dp large screens are at least 640dp x 480dp normal screens are at least 470dp x 320dp small screens are at […]

围绕UIImageView的内容绘制边框

我有一个UIImageView与图像是一个透明背景的汽车: 我想在车上画一个边框: 我怎样才能达到这个效果? 目前,我已经用这种方式testing了CoreGraphics,但没有好的结果: // load the image UIImage *img = carImage; UIGraphicsBeginImageContext(img.size); CGContextRef context = UIGraphicsGetCurrentContext(); [[UIColor redColor] setFill]; CGContextTranslateCTM(context, 0, img.size.height); CGContextScaleCTM(context, 1.0, -1.0); CGContextSetBlendMode(context, kCGBlendModeNormal); CGRect rect = CGRectMake(0, 0, img.size.width * 1.1, img.size.height*1.1); CGContextDrawImage(context, rect, img.CGImage); CGContextClipToMask(context, rect, img.CGImage); CGContextAddRect(context, rect); CGContextDrawPath(context,kCGPathFill); // generate a new UIImage from the graphics context […]

如何从iOS照片(如相机胶卷)获取图像创build的date时间或上次修改的date时间?

我是iOS的新人。 最近,我正在开发一个iOS应用程序,需要检查图像(在iOS 照片中 )创builddate时间和修改date时间,以便按时间sorting这些图像。 我使用ALAssetsLibrary枚举所有的图像,我可以得到每个图像的以下属性:图像文件名,图像资产url(在它,我可以得到图像文件扩展名和唯一的资产ID)。 但有人可以告诉我如何获取图像文件创builddate时间和上次修改date时间? 非常感谢。

获取设备图像比例(例如@ 1x,@ 2x和@ 3x)

我有一个应用程序,使用服务来获取一些图标。 有了这个服务,我可以得到任何大小的图像,所以我计划得到3个图像(@ 1x,@ 2x和@ 3x)并将它们存储在BBDD上,然后使用这三个图像中的一个; 或者根据设备规模只能获得一个。 但事情是,我怎样才能以编程方式获得设备规模(@ 1x,@ 2x和@ 3x)? Obj-c和Swift都受欢迎;)

从parse.com检索图像

我不知道这是否可能,但我认为这是可能的,我不知道如何做到这一点。 我只是想从parse.com加载一个图像,就像从parse.com中检索对象一样。 我应该以同样的方式从parse.com获取string吗? 我刚刚发现如何保存图像的parsing,但没有如何让他们。 我会很高兴,如果有人可以告诉我一个链接来做到这一点或示例代码。 我已经设置了一个从parse中获取的string: PFQuery *query = [PFQuery queryWithClassName:@"app"]; [query getObjectInBackgroundWithId:@"ID" block:^(PFObject *textdu, NSError *error) { if (!error) { UIFont *welcomeLabelFont = [UIFont boldSystemFontOfSize:17]; welcomeLabel.text = [textdu objectForKey:@"ueberschriftnews"]; welcomeLabel.font = welcomeLabelFont; welcomeLabel.textColor = [UIColor whiteColor]; welcomeLabel.textAlignment = NSTextAlignmentCenter; welcomeLabel.backgroundColor = [UIColor clearColor]; welcomeLabel.shadowColor = [UIColor blackColor]; welcomeLabel.shadowOffset = CGSizeMake(0, 1); [contentView addSubview:welcomeLabel]; // […]

如何从无符号字符创build图像*

我正在尝试从unsigned char *中的原始数据创build一个新的图像。 我从存储的数据中获得每像素的位数。 我试图将原始数据转换成NSData,但结果图像是零, unsigned char * bitmap = myData; NSUInteger myImageDataLength = strlen((const char *)bitmap); NSData * d = [NSData dataWithBytes:bitmap length:myImageDataLength]; imgView.image = [UIImage imageWithData:d]; 然后我尝试使用上下文创build一个图像,如下所示: CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB(); int width = mWidth; int height = mHeight; size_t bpp = mBpp; size_t bpc = 8; size_t bpr = (width * 4); […]