草庐IT

set_allocated

全部标签

iOS 自动布局 : Set the trailing space equal to the width of the superview

我需要使用自动布局将View定位在其父View的右边界之外。我试图通过指定以下NSLayoutConstraint来做到这一点:NSLayoutConstraint*leftConstraint=[NSLayoutConstraintconstraintWithItem:self.downloadViewattribute:NSLayoutAttributeLeftrelatedBy:NSLayoutRelationEqualtoItem:self.contentViewattribute:NSLayoutAttributeWidthmultiplier:1.0constant:0.0

ios - NSUserDefault , Alloc init 与标准 Userdefault

我很困惑之间有什么区别NSUserDefaults*userDefault=[NSUserDefaultsstandardUserDefaults];和NSUserDefaults*userDefault=[[NSUserDefaultsalloc]init];谁能帮帮我……提前致谢 最佳答案 NSUserDefaults*userDefault=[NSUserDefaultsstandardUserDefaults];theabovelinegivesyouthesingletonobjectbyusingtheclassmeth

ios - "loaded the "XXX "nib but the view outlet was not set."- 再次

首先我检查了关于这个主题的所有其他问题:提供的答案似乎是:确保将文件的所有者设置为自定义ViewController类(我已这样做)确保你有一个从View到文件所有者(我有)的引用导出我的代码被编译成一个静态库,我导出了.a文件和xib文件。我使用它的示例应用程序在其包中包含xib(构建阶段的“复制包资源”)在我的库代码中,我在一个单独的UIViewContoller子类中有一个函数,用于从Nib创建ViewController:-(void)presentCustomController{self.vCtrl=[[CustomControlleralloc]initWithNibNa

ios - OCMock - 部分模拟 [UIAlertView alloc]

我在使用iOS的OCMock框架时遇到问题。我本质上是在尝试模拟UIAlertView的initWithTitle:message:delegate...方法。下面的示例在我调用initWithTitle方法时未返回stub返回值的意义上不起作用。UIAlertView*emptyAlert=[UIAlertViewnew];idmockAlert=[OCMockObjectpartialMockForObject:[UIAlertViewalloc]];[[[mockAlertstub]andReturn:emptyAlert]initWithTitle:OCMOCK_ANYmess

iphone - iOs:为什么 IBOutlets 在 [[alloc] init] 之后没有连接,而是在 viewDidUnload 之后连接:已被调用

我有一个简单的UINavigationViewController,当某个项目被选中时,它会创建一个模态视图,其中有一个UIImageView(下面的PostcardViewController)。但是,如果我调用PostcardViewController*postcardViewController=[[PostcardViewControlleralloc]init];postcardViewController.imageView.image=image;[self.navigationControllerpresentModalViewController:postcardV

ios - "Attempt to set a non-property list object...."带有自定义类的 NSMutableDictionary

这个问题在这里已经有了答案:Writecustomobjectto.plistinCocoa(3个答案)关闭8年前。我有一个名为ServerModule的自定义类,它是NSObject的子类。我基本上将所有这些ServerModule和键值对存储在NSMutableDictionary中。然后字典存储在NSUserDefaults中。我了解到NSUserDefaults仅在访问对象时返回对象的不可变版本,因此我将字典初始化更改为:_AllModules=[[NSMutableDictionaryalloc]initWithDictionary:[_editServerModulesob

ios - 在 iOS 应用程序上运行泄漏会引发 "Cannot allocate mmap"错误

我创建了一个iOS应用程序,需要以编程方式检查应用程序中的漏洞。(因此不直接使用仪器)对于以上内容,我使用如下泄漏命令:MallocStackLogging=1泄漏-无上下文在某个时间点,这可以正常工作,没有问题。但最近我开始遇到错误,每次泄漏命令都会给出不同数量的泄漏。有人遇到过类似的问题吗? 最佳答案 您可以使用vm_statics对象以编程方式查找当前内存统计信息。通过这些链接找到vm_statistics的实现:1)http://gamesfromwithin.com/whered-that-memory-go2)http:

ios - 如何允许用户从 Settings.app 中的默认声音中选择通知声音?

我想知道是否可以允许用户在Settings.app->Notifications中将我的应用程序的推送通知声音更改为任何默认声音(类似于如何在此处更改消息的提示音).如果是这样,我需要更改代码以允许这样做吗?我需要更改Settings.bundle吗? 最佳答案 您可以将用户选择的声音文件的名称(连同设备token)发送到您的服务器并将其存储在您的数据库中。当您向该用户的设备发送推送通知时,您将从数据库中获取声音文件名并将其放入通知负载的sound属性中。如果用户没有选择特定的声音,您可以在通知负载中发送一个默认的声音文件名。

ios - 使用 InAppSettingsKit 本地化 Settings.bundle 中的字符串

我正在尝试使用InAppSettingsKit来管理我的设置。这使用带有.plist文件的Settings.bundle和每种正在翻译的语言的.strings文件。我可以使用设置应用程序确认我的字符串翻译在我的应用程序之外正常工作。但是当我在我的应用程序中时,翻译没有发生。我认为它归结为这样的代码,来自InAppSettingsKit类IASKSettingsReader,以及一些我认为有用的日志记录语句:-(NSString*)titleForStringId:(NSString*)stringId{NSLog(@"%@",[_bundlelocalizedStringForKey:

html - ionic 3 : How to Set Background to Transparent in IOS with QR Scanner Plugin?

我正在使用IonicNative插件QRSCANNER,但IOS中的应用程序未显示预览。做了很多研究,但没有解决方案。我已经设置了background-color:transparent!important几乎所有内容,包括:html,body,ion-app,ion-content,ion-page,.nav-decor,content-md,content-ios,ion-app.ios,.fixed-content,.scroll-content{background-color:transparent!important;}但IOS中的应用程序仍然显示白屏而不是预览,并且QR扫