- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
UIAlertView *alert;
// Unable to save the image
if (error)
alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Unable to save image to Photo Album."
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
else // All is well
alert = [[UIAlertView alloc] initWithTitle:@"Success"
message:@"Image saved to Photo Album."
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
[alert release];
}
// Define at top of implementation file
CGImageRef UIGetScreenImage(void);
...
- (void)buttonPressed:(UIButton *)button
{
// Capture screen here...
CGImageRef screen = UIGetScreenImage();
UIImage* image = [UIImage imageWithCGImage:screen];
CGImageRelease(screen);
// Save the captured image to photo album
UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
}
分享到:
相关推荐
在数字系统设计中,IP( Intellectual Property)核是可重用的硬件模块,它们提供了特定的功能,如计数器、接口控制器、数字信号处理单元等。"Avalon总线下的PWM IP Core"是一个专为Avalon总线设计的脉宽调制(PWM)...
fs/yaffs2/yaffs_vfs.c:2383:2: error: implicit declaration of function 'get_sb_bdev' fs/yaffs2/yaffs_vfs.c: At top level: fs/yaffs2/yaffs_vfs.c:2390:2: error: unknown field 'get_sb' specified in ...
fs/yaffs2/yaffs_vfs.c:530: error: implicit declaration of function 'truncate_setsize' fs/yaffs2/yaffs_vfs.c: At top level: fs/yaffs2/yaffs_vfs.c:876: warning: initialization from incompatible pointer ...
模板方法模式是面向对象设计中的一种经典模式,它在C++编程中有着广泛的应用。该模式主要用于定义一个算法的框架,允许子类在不改变算法整体结构的情况下,对算法的某些特定步骤进行重定义。这种模式是基于继承的...
当编译程序发现程序中某个地方有疑问,可能有问题时就会给出一个警告信息。警告信息可能意味着程序中隐含的...显示:warning: implicit declaration of function ‘Example()’。 警告原因: 在你的.c文件中调用了函数
sh a 364 suid.c: In function 'main': suid.c:3: warning: incompatible implicit declaration of built-in function 'execl' sh-3.1# id uid=0(root) gid=0(root)
+ Added function TCustomXml.InsertDocType to hide the complexity of inserting a TsdDocType manually ! fixed small leak in class TsdDocType + Added Test15 to diagnose TCustomXml.InsertDocType ! fixed ...
Enhanced the implementation of the "serialized mode" of the interpreter (enabled via the AcpiGbl_AllMethodsSerialized flag.) When this mode is specified, instead of creating a serialization semaphore ...
"dereferencing type-punned pointer will break strict-aliasing rules" "differ in signedness" "but argument is of type" "implicit declaration of") if [ $# -lt 1 ]; then echo "Usage: $0 <logfile>" ...