Tag: 目标C

从代码访问iOS设置

可能重复: 以编程方式访问iPhone系统设置 如何从我的代码访问iPhone的设置? 如何使用OS 4.0访问iPhone通用辅助function设置 如何访问iPhone的一般无障碍设置 iPhone设置 访问iphone设置偏好 有没有办法,从我的代码查询iOS设置应用程序的特定设置? 例如,我想知道“多任务手势”是否打开? 甚至能够改变设置?(从我的研究,似乎我绝对不能这样做)

如何sortingdate对象的NSMutableArray

我正在做一些小的工作,在NSMutableArray中sortingdatestring,我从sqlite数据库获取数组。 如果你打印的数组是这样显示的 datestring为(“2011-05-01”,“2011-02-01”,“2012-01-08”,“2012-05-08”,“2010-01-09) 我想按升序显示date。 请帮助我的家伙…..我是新手objc ..

垃圾收集是否支持iPhone应用程序?

iPhone是否支持垃圾收集? 如果是这样,那么使用+alloc和-init组合执行操作的替代方法是什么? NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithData:xmlData]; UIImage *originalImage = [[UIImage alloc] initWithData:data]; detailViewController = [[[DetailViewController alloc] initWithNibName:@"DetailView bundle:[NSBundle mainBundle]] autorelease]; …和其他命令。 提前感谢您提供任何帮助或指导。

强制整个屏幕上的横向方向MPMoviePlayerController在退出全屏时阻止正确的旋转

我有一个支持所有接口方向的iPhone应用程序(iOS6 +)。 但是,当MPMoviePlayerController正在全屏播放video时,只应支持横向。 我发现堆栈溢出下面的解决scheme,它的工作原理。 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerWillEnterFullscreenNotification:) name:MPMoviePlayerWillEnterFullscreenNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerWillExitFullscreenNotification:) name:MPMoviePlayerWillExitFullscreenNotification object:nil]; … -(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { if (self.landscapeOnlyOrientation) { return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight; } return UIInterfaceOrientationMaskAll; } – (void)moviePlayerWillEnterFullscreenNotification:(NSNotification*)notification { self.landscapeOnlyOrientation = YES; } – (void)moviePlayerWillExitFullscreenNotification:(NSNotification*)notification { self.landscapeOnlyOrientation = NO; } 然而,一个恼人的问题仍然存在,即如果video以纵向方式退出全屏(在强制横向播放之后),则底层视图不会旋转回来。 我必须手动将设备旋转到横向,然后回到纵向触发更新方向。 有什么办法可以触发这种更新程序? 下面的一组截图应该说明我的意思: 注意:由于各种原因,使用MPMoviePlayerViewController是不可能的。

如何访问相机和相机卷Objective-C

我正在制作一个需要访问相机和相机胶卷的通用iOS应用程序。 我将如何去做这件事? 我没有代码显示,因为该应用程序主要是基于此。

iOS中的单例Objective C不会阻止多个实例

我知道有几个线程,但没有回答我的问题。 我已经实现了像这样的单身类(意识到关于单身人士的争议): + (MyClass*) sharedInstance { static MyClass *_sharedInstance = nil; static dispatch_once_t oncePredicate; dispatch_once(&oncePredicate, ^{ _sharedInstance = [[MyClass alloc] init]; }); return _sharedInstance; } – (instancetype)init{ self = [super init]; if (self) { //setup code } return self; } 我试着实例化一个不同的对象,并用'=='与sharedInstance返回的对象进行比较,确实不同。 问题: 不应该创build单个类的多个对象是不可能的? 这不是重点吗? Java中的单例实现可以防止它。 如果是的话,怎么样? 我应该做一个设置方法,并调用它,而不是执行init和做? 这是正确的实施?

Facebook应用程序邀请通知不在ios中工作

我已经在演示应用程序中实施了Facebook应用程序邀请。 它工作正常,但没有得到通知。 我已经在我的问题中添加了所有细节,现在任何人都可以告诉我在我的代码中是什么问题,我该怎么做才能解决这个问题。 我已经创build了testing用户来testing这个应用程序。 此代码工作正常,它启动一个对话框,显示好友列表,并显示应用程序邀请被发送,但当我检查它在朋友帐户它不显示任何通知。 我的Info.plist文件 我想我在URLtypes(URL Schemes)下的info.plsit中有一个错误。 我已经写了行动,这是方法的名称,但我不知道我应该写在这个专栏。 Appdelegate.m – (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { BFURL *parsedUrl = [BFURL URLWithInboundURL:url sourceApplication:sourceApplication]; if ([parsedUrl appLinkData]) { NSURL *targetUrl = [parsedUrl targetURL]; [[[UIAlertView alloc] initWithTitle:@"Received link:" message:[targetUrl absoluteString] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show]; } return YES; } ViewController.h 当appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didCompleteWithResults:(NSDictionary *)results获取结果为null appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog […]

如何使MKAnnotationView触摸敏感?

我目前有一个地图视图上有一些注释。 我有自定义图像的注释。 我试图解决的问题是图像的敏感性。 当我试图拖动它们时,感觉就像我必须触摸确切的中心来重点关注它。 有没有办法让触摸范围更大?

基于内容的dynamicUITableView单元格高度

我有一个UITableView填充自定义单元格(从UITableViewCellinheritance),每个单元格包含一个UIWebView ,根据它的内容自动resize。 这里的东西,我怎么能根据他们的内容(variableswebView )来改变UITableView单元格的高度。 解决scheme必须是dynamic的,因为用于填充UIWebViews的HTML从不断变化的提要中parsing。 我有一种感觉,我需要使用UITableView委托方法heightForRowAtIndexPath但从它的定义: – (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { ;//This needs to be variable } 我无法访问单元格或它的内容。 我可以在cellForRowAtIndexPath更改单元格的高度吗? 任何帮助将是伟大的。 谢谢。 注意 两年前我问过这个问题。 随着自动布局的介绍,iOS7的最佳解决scheme可以find: http://t.co/PdUywcTjhu 而在iOS8上,这个function是在SDK中构build的

委托]窗口]和 .keyWindow之间的区别?

你好我是新手在iPhone开发任何一个可以帮助我知道以下两行之间的区别: 第一: [[[[UIApplication sharedApplication] delegate] window] addSubview:UIView]; 第二: [[UIApplication sharedApplication].keyWindow addSubview:UIView]; 提前致谢。