Tag: iphone

iPhone – 3次UIGestureRecognizer的多次检测

我有3个UIGestureRecognizers附加到视图:一个手指双击,两个手指双击和一个手指三击。 问题是这样的:当我点击三次时,它会触发应该通过双击然后三次点击的方法触发的方法。 这是我添加它的方式。 // one finger double tap doubleTap = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)] autorelease]; [doubleTap setCancelsTouchesInView:YES]; [doubleTap setNumberOfTapsRequired:2]; [doubleTapDoisDedos setNumberOfTouchesRequired:1]; [doubleTap setDelegate:self]; [[[CCDirector sharedDirector] openGLView] addGestureRecognizer:doubleTap]; // two fingers double tap twoFingerDoubleTap = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTapTwoFingers:)] autorelease]; [twoFingerDoubleTap setCancelsTouchesInView:YES]; [twoFingerDoubleTap setNumberOfTapsRequired:2]; [twoFingerDoubleTap setNumberOfTouchesRequired:2]; [twoFingerDoubleTap setDelegate:self]; [[[CCDirector sharedDirector] openGLView] addGestureRecognizer:twoFingerDoubleTap]; // triple tap com […]

让UITextView对点击事件作出反应。 (苹果手机)

我正在尝试实现一个可滚动的文本视图(不可编辑),显示一些帮助信息等。当用户完成它所有他需要做的就是点击它,它将消失/隐藏,用户将回来主屏幕。 UITextview没有对点击事件作出反应(或者我不确定如何使其对点击事件作出反应)。 知道如何实现这个吗? 我也尝试将它放在透明按钮内,这样我就可以捕捉到水龙头但是我无法滚动文本视图,因为它看起来像是按钮。 我是iphone的新手,任何帮助…… gr8 谢谢

iOS开发: viewControllers]的原因是什么? 会回来没有?

以下声明返回零… NSArray *viewControllersInNavStack = [[self navigationController] viewControllers]; 并且这个语句是在一个视图控制器中调用的,它在导航堆栈中大约有四个级别,所以我不明白它是如何或为什么会返回nil。 你的想法? 非常感谢你的智慧!

由于UIPopoverController,通用iOS应用程序在iPhone / iTouch 3.1.3上崩溃

我刚刚更新了我的应用程序,因此它是一个通用应用程序。 这样做我在某个地方添加了对UIPopoverController支持。 现在该应用程序似乎在3.1.3 iPhone / iTouch设备上崩溃: OS Version: iPhone OS 3.1.3 (7E18) Report Version: 104 Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x00000001, 0xe7ffdefe Crashed Thread: 0 Dyld Error Message: Symbol not found: _OBJC_CLASS_$_UIPopoverController 我没有得到的是,如果硬件是iPad,我只会尝试调用UIPopoverController: if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:btc]; CGSize popoverSize = { 300.0, 500.0 }; popover.delegate = self; […]

MPMoviePlayerController不播放新保存的video文件

我正在使用imagePickerController来录制video。 在imagePickerController:didFinishPickingMediaWithInfo: function我试图将video设置为先前定义的MPMoviePlayerController: if ([mediaType isEqualToString:(NSString *)kUTTypeMovie]){ NSURL *movieUrl = [info objectForKey:UIImagePickerControllerMediaURL]; [self.moviePlayer setContentURL:movieUrl]]; } 这工作正常,video确实在播放。 但是我想保存文件供以后使用。 当我这样做并使用保存的文件为moviePlayer,没有任何反应: 我试过这个(将数据保存到新文件) NSString *directory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString *newPath = [directory stringByAppendingPathComponent:@”myMovie.mov”]; NSData *videoData = [NSData dataWithContentsOfURL:movieUrl]; [videoData writeToFile:newPath atomically:NO]; [self.moviePlayer setContentURL:[NSURL URLWithString:newPath]]; 或者这个(将临时video文件复制到我的文档文件夹) NSString *directory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString *newPath = [directory stringByAppendingPathComponent:@”myMovie.mov”]; […]

iOS应用程序在Core Location回调机制中崩溃

我在分析我的崩溃日志时遇到问题。 当我点击应用程序图标启动应用程序时,iPhone有时会崩溃。 该应用已在后台“运行”,但它不活跃。 这是符号化的崩溃日志: Thread 0 Crashed: 0 libobjc.A.dylib 0x33479470 objc_msgSend + 28 1 CoreLocation 0x3436f68e -[CLLocationManager onClientEvent:supportInfo:] + 98 2 CoreLocation 0x3436f804 OnClientEvent + 16 3 CoreLocation 0x3436b522 CLClientInvokeCallback(__CLClient*, CLClientEvent, __CFDictionary const*) + 42 4 CoreLocation 0x3436cf74 CLClientHandleDaemonDataRegistration(__CLClient*, CLDaemonCommToClientRegistration const*, __CFDictionary const*) + 668 5 CoreLocation 0x3436d4c8 CLClientHandleDaemonData(__CFMessagePort*, long, __CFData const*, void*) + 212 […]

使用JSON字符串使用RestKit手动将对象加载到Core Data中

使用restkit的开发分支(0.20),有没有办法将JSON字符串映射到核心数据对象存储中? 我知道在0.10中, 本页底部描述的方法有效但是如何在restkit 0.20中执行此操作? 任何指导赞赏! 谢谢! id parser = [[RKParserRegistry sharedRegistry] parserForMIMEType:MIMEType]; id parsedData = [parser objectFromString:JSONString error:&error]; RKObjectMappingProvider* mappingProvider = [RKObjectManager sharedManager].mappingProvider; RKObjectMapper* mapper = [RKObjectMapper mapperWithObject:parsedData mappingProvider:mappingProvider]; RKObjectMappingResult* result = [mapper performMapping];

适用于iphone / iOS的 runningApplications]的等价物?

我一直在研究Apple文档已经有一段时间了,但是没有找到iOS的等效于可以从AppKit中的NSWorkspace获得的sharedWorkspace对象。 基本上,我只想runningApplications方法。 谁能指出我正确的方向?

AVAudioPlayer:音量按钮适用于某些设备,而不适用于其他设备

我有一个使用AVAudioPlayer播放一些嵌入式MP3文件的应用程序。 音量按钮在3GS上可靠地工作我主要用于测试 – 它们在4.1下工作并且在升级到4.3.1之后立即工作。 在我老板的iPhone 4上运行4.2.1,他们似乎根本不在我们的应用程序中工作; 在iPod Touch(也是运行4.2.1)这是我的辅助测试机器上,我已经能够让它们工作一次,但无法重现我是如何做到的。 我尝试了一个黑客,我发现,在应用程序启动时创建一个虚拟AVAudioPlayer ,但保持在prepareToPlay状态,并发现我能够在我的初始屏幕上使用音量按钮,但是一旦我播放真正的音频,他们就停止了工作。 有人碰到这个吗? 任何想法为什么它适用于某些手机而非其他手机? 更新:我将Touch更新为4.3.1,问题就消失了。 因此我认为它可能是4.2.1中的一个错误,但我仍然想知道是否有人看到它和/或可以指向我的错误报告。

UITextView – 设置attributionText的字体大小慢?

我正在尝试使用以下内容更改我的UITextView文本的字体大小,该文本使用属性文本: UIFont *font = [self.textView.font fontWithSize:value]; NSDictionary *attributes = @{ NSFontAttributeName: font }; NSMutableAttributedString *attrString = [self.textView.attributedText mutableCopy]; [attrString addAttributes:attributes range:NSMakeRange(0, attrString.length)]; self.textView.attributedText = attrString; 但是,将此与滑块结合使用会导致明显的减速。 我这样做了吗? 简单设置textView.font属性的字体大小不起作用。 这就是我首先设置属性文本的方式: NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:@”Neutra church-key brunch farm-to-table disrupt skateboard, bushwick next level organic gentrify street art. Pop-up echo park pork belly pour-over. Bespoke meggings […]