使用glReadPixel()与多重采样读取数据

目前我正在尝试从帧缓冲区中读取像素数据以捕获IOS中的屏幕。 使用下面的代码来设置帧缓冲区时,GlreadPixels命令工作正常。 //buffers // Create a depth buffer that has the same size as the color buffer. glGenRenderbuffersOES(1, &m_depthRenderbuffer); glBindRenderbufferOES(GL_RENDERBUFFER_OES, m_depthRenderbuffer); glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT24_OES, width, height); // Create the framebuffer object. glGenFramebuffersOES(1, &framebuffer); glBindFramebufferOES(GL_FRAMEBUFFER_OES, framebuffer); glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, m_colorRenderbuffer); glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, m_depthRenderbuffer); glBindRenderbufferOES(GL_RENDERBUFFER_OES, m_colorRenderbuffer); glBindFramebufferOES(GL_FRAMEBUFFER_OES, framebuffer); 但是当我使用深度缓冲区和颜色缓冲多采样glreadpixels()不捕获任何像素数据像以前的代码….多采样我使用以下代码: – glGenFramebuffersOES(1, &sampleFramebuffer); glBindFramebufferOES(GL_FRAMEBUFFER_OES, sampleFramebuffer); //GLuint sampleColorRenderbuffer; glGenRenderbuffersOES(1, […]

我如何使用CocoaAsyncSocket读取数据?

我在我的appDelegate didFinishLaunchingWithOptions方法中创build了一个TCP套接字连接 。 这是很容易的一部分,我已经成功连接到我的服务器。 我很难从我的视图中读取服务器的数据。 我一直在浏览如何适当(一步一步)使用CocoaAsyncSocket读取数据的教程 ,但我没有遇到任何有用的东西。 这是我的代码从我的appDelegate: -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { socket = [[AsyncSocket alloc] initWithDelegate:self]; [self connect]; self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; // Override point for customization after application launch. self.viewController = [[[tekMatrixViewController alloc] initWithNibName:@"tekMatrixViewController" bundle:nil] autorelease]; self.window.rootViewController = self.viewController; [self.window makeKeyAndVisible]; return YES; } 这里是我的连接方法,在appDelegate文件的底部: – (void)connect { […]

使对象保持活动状态,直到后台任务完成

我试图实现一个方法,在后台执行一个任务,然后调用主线程上的一个块: + (void)migrateStoreWithCompletionHandler:(MigrationControllerCompletion)completion { MigrationController *controller = [[MigrationController alloc] initWithCompletionBlock:completion]; [controller migrateStore]; } 这是-initWithCompletionBlock:方法: – (id)initWithCompletionBlock:(MigrationControllerCompletion)completion { self = [super init]; if (self) { _completion = [completion copy]; } return self; } 后台工作发生在-migrateStore 。 问题是ARC在[controller migrateStore]之后释放controller 。 因为controller是保持在块上的对象,我不能永远称它。 有没有人有任何build议如何解决这个问题?

Bonjour在背景?

我注意到,用于iOS的剪贴板应用程序Pasteboard可以在后台运行Bonjour服务。 我不知道他们是如何实现的,所以我在互联网上search,然后发现它在后台播放一个沉默的声音文件。 但现在不是这样,因为我看不到iPodpipe理屏幕上的应用程序图标。 他们怎么能这样做? 有任何想法吗? 先谢谢你。 凯。

如何使用UIActivityItemProvider设置邮件主题

我正在使用UIActivityViewController通过电子邮件共享信息。 我们可以发送电子邮件与正文,附件没有问题。 但是,我们如何设置电子邮件的主题标题。 我注意到这个问题: 如何在UIActivityViewController中设置邮件主题? 接受的解决scheme是使用UIActivityItemSource与以下API activityViewController:subjectForActivityType:。 但是,我们的代码不符合UIActivityItemSource因为我们正在使用UIActivityItemProvider 。 UIActivityItemSource 您可以在您希望从应用程序的某个现有对象提供数据的情况下使用此协议,而不是创build单独的UIActivityItemProvider对象。 所以完整的问题是: 如何使用UIActivityItemProvider而不是UIActivityItemSource设置电子邮件主题?

dynamic地改变目标C中单元的高度

我创build了一个表视图的应用程序。 在每个单元格中使用视图和标签。 但是,如果我在(!单元格)代码中创build视图和单元格,它会返回空单元格,如果删除(!单元格)条件,则会显示数据但不会占用dynamic高度。 谁能帮帮我吗。 – (void)viewDidLoad{ NSString *Path = [[NSBundle mainBundle] bundlePath]; NSString *DataPath = [Path stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.plist", LanguageFile]]; NSMutableDictionary *tempDict = [[NSMutableDictionary alloc] initWithContentsOfFile:DataPath]; self.reloadArray = [tempDict objectForKey:@"Rows"];} -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return [self.reloadArray count]; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 1; } – (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { // Get data for the current […]

没有findPhonegap 2.1.0 Cordova / CDVViewController.h文件

我已经安装了Xcode 4.5(没有安装以前的phonegap版本)。 我已经下载,提取并通过Phonegap教程创build项目: http ://docs.phonegap.com/en/2.1.0/guide_getting-started_ios_index.md.html#Getting%20Started%20with%20iOS 在terminal命令之后: ./create myproject〜/ Desktop / myproject com.test.myproject我有成功创build的结构。 比我推出xcode和想玩这个例子项目。 Xcode构build失败,并说: 未find词法或处理器问题“Cordova / CDVViewController.h”文件 我试图将这个缺less的头添加到类文件夹,修复了导入语法,但仍然是同样的问题。 有人解决了这个问题吗?/如何?

旧的图书馆,新的cocoa豆

因为CocoaPods 0.36对任何人都是可用的,他们现在提供Swift和Frameworks支持,所以今天有一个问题困扰着我… 我在我的项目目录中创buildPodfile ,填入: source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' pod 'AFNetworking' pod 'SwiftyJSON' 像平常一样运行pod install …你知道这个故事。 但是,当我打开我的.xcworkspace并去任何ViewController和import SwiftyJSON它只是工作,但是当我尝试做AFNetworking同样的事情,我得到No such module 'AFNetworking' 。 当然,我可以创build一个Bridging-Header并用Objective-C方式导入它,但是当我阅读这篇博文时,我可以看到: 要在Swift中使用这个subspec,没有生成的伞头,你需要创build一个桥接头,并使用像#import <AFNetworking/AFNetworking+UIKit.h 。 使用生成的伞标题,只需要import AFNetworking ,如果你的Podfile中包含subspec。 纠正我,如果我错了,但我想如果我们用CocoaPods添加库不再需要手动Bridging-Header,对吧? 那么,为什么这不起作用?

如何在iOS 7 iPad App Store中同时翻转和放大UIView?

iPad的iOS 7应用程序商店有一个非常酷的animation,当你点击一个应用程序图标(从图标较小,而不是search结果的特色列表)。 这是一个在实践中的图片: 基本上,图标同时翻转和扩大。 它后面有一个渐变,内容视图更小。 到目前为止,我有一个自定义的VC转换设置,我的扩大部分工作正常,但我不能翻转jive。 我该如何模仿App Storeanimation? 这是我到目前为止的代码: – (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext { UIView *inView = [transitionContext containerView]; UIViewController *fromVC = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; UIViewController *toVC = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; UIView *fromView = [fromVC view]; UIView *toView = [toVC view]; toView.frame = [transitionContext finalFrameForViewController:toVC]; // Take a snapshot of the new view being presented UIGraphicsBeginImageContextWithOptions(toView.bounds.size, NO, 0); CGContextRef […]

使用Xcode 4.3.x为iOS 3.0构build通用应用程序 – NSKeyedUnarchiverexception

尝试使用Xcode 4.3.2构build和debuggingiOS 3.0的通用应用程序。 我从NSKeyedUnarchiver得到一个NSException。 看来这可能与无法读取主.xib文件有关。 我已经看到了这一点: iOS和unarchiving xib文件 – 然而,在这种情况下,它不是清楚的应用程序是通用的(他们的解决scheme不起作用)(注意:他们的解决scheme不工作,因为他们使用Xcode 4.2,而不是4.3)。 这是错误输出: 2000-01-01 11:00:39.-19 myApp[664:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSKeyedUnarchiver initForReadingWithData:]: incomprehensible archive (0x4e, 0x49, 0x42, 0x41, 0x72, 0x63, 0x68, 0x69)' 2000-01-01 11:00:39.-01 myApp[664:207] Stack: ( 808001701, 805397928, 807551015, 807550919, 810902709, 815043196, 815042704, 814682908, 814682012, 814970032, 814968048, 814966908, 839149932, […]