草庐IT

method_details

全部标签

ios - -[__NSCFDictionary setObject :forKey:]: mutating method sent to immutable object

运行以下代码时,[dictsetValue:@"null"forKey:@"name"];一直崩溃。我在这里搜索,发现其他帖子是由不使用NSMutableDictionary的人引起的。但是我正在使用它。如果name为null,为什么会在这一行崩溃?NSMutableArray*tempCustomers=[[NSMutableArrayalloc]init];for(NSMutableDictionary*dictin[[jsonobjectForKey:@"data"]mutableCopy]){if([dictobjectForKey:@"name"]==[NSNullnull]

ios - 非公开 API 使用 : Apps are not permitted to access the UDID and must not use the uniqueIdentifier method of UIDevice

在Xcode6.3中验证我的应用程序时,出现以下错误:没有第三方框架,例如AdMob、GoogleAnalytics、Flurry或Facebook,在应用程序中使用。仅使用内置框架。此外,应用中使用的框架是最新的。我在终端中尝试了以下命令来查找使用UDID的类;find.|grep-v.svn|grep".a"|grep-v".app"|xargsgrepuniqueIdentifier但没有此类文件的列表。我还在我的代码中搜索了**[[UIDevicecurrentDevice]uniqueIdentifier]**,但它没有在任何地方使用。那么我应该怎么做才能解决这个问题呢?

ios - Master/Detail 应用程序中的 NavigationItem

我使用XCode的Master/Detail模板编写了一个Master/Detail应用程序。启动应用程序后,主视图导航按钮的标题就是“主”。现在我想重命名那个按钮,但不幸的是我不知道如何访问这个按钮。在appdelegate.m中有以下代码来初始化View:MasterViewController*masterViewController=[[MasterViewControlleralloc]init];UINavigationController*masterNavigationController=[[UINavigationControlleralloc]initWithRo

ios - 如何从 NSExpression 的 expressionValueWithObject :context method? 获取 float

我已经实现了一个自定义计算器,我在其中使用以下代码来计算类似5+3*5-3的算术表达式。-(NSNumber*)evaluateArithmeticStringExpression:(NSString*)expression{NSNumber*calculatedResult=nil;@try{NSPredicate*parsed=[NSPredicatepredicateWithFormat:[expressionstringByAppendingString:@"=0"]];NSExpression*left=[(NSComparisonPredicate*)parsedleftE

ios - OCMock "expected method was not invoked"即使我自己调用它

我正在尝试在iOS项目中设置一个简单的OCMock单元测试,以熟悉框架。我有一个模拟的DataLoader类,即使我自己调用该方法,我的期望也失败了:-(void)testSimpleMocking{//Mocktheclassidmock=[OCMockObjectniceMockForClass:[DataLoaderclass]];//Overridethe'dispatchLoadToAppDelegate:'tobeano-op[[[mockstub]andReturn:nil]dispatchLoadToAppDelegate:[OCMArgany]];//Expectth

ios - Xamarin 表格 : Master Detail Page : How to disable swipe gesture to load the menu on iOS

我需要屏幕在上面画东西。由于我在同一屏幕上有一个MasterDetailPage,每当我在打开菜单的方向上绘制时,菜单会在我绘制的同时滑动打开。有没有办法阻止它滑动打开,但仍然可以点击菜单按钮打开它。 最佳答案 我找到了解决方案:#if__IOS__IsGestureEnabled=false#endif将IsGestureEnabled设置为false将停止滑动打开菜单。该值只能为iOS设置。如果我为android设置,菜单按钮在点击时不会打开菜单。 关于ios-Xamarin表格:M

iphone - 抑制警告 : Meta method xx in category from xx conflicts with same method from another category

如何抑制此编译器警告:“...soap+prefix.o”类别中的元方法“prefix”与另一个类别中的相同方法冲突?这是类别soap+Prefix.h:@interfaceSoap(Prefix)+(NSString*)prefix;@end和soap+prefix.m:#import"Soap.h"#import"Soap+Prefix.h"@implementationSoap(Prefix)+(NSString*)prefix{return@"EInspector";}@end顺便说一句,这两个文件是使用SudZc为Web服务包装器自动生成的。附注此警告仅在XCode4.4中发

ios - ([NSAttributedString boundingRectWithSize :options:context:])method can not get the right size within NSTextAttachment

在我的代码中:NSMutableAttributedString*str=[[NSMutableAttributedStringalloc]initWithString:@"12123"];NSTextAttachment*attachment=[[NSTextAttachmentalloc]init];attachment.image=[UIImageimageNamed:@"002"];attachment.bounds=CGRectMake(0,0,20,20);[strinsertAttributedString:[NSAttributedStringattributedStr

ios - UISplitViewController + Split View : hide details at startup

我在iPad应用程序中有一个UISplitViewController,直到现在我在启动时将占位符设置为详细信息ViewController,因此在用户选择一个项目之前,屏幕的右侧部分不会看起来是空的。但是现在,在iOS9上,当使用50/50水平SplitView(多任务处理)时,SplitViewController会自动推送我的占位符,当然我希望它显示主视图,因为在这种情况下占位符不需要。有人知道如何避免这种自动行为吗?也许有一段API可以做到这一点,但我错过了?像“selectViewController:”这样的东西告诉SplitViewController显示主视图或详细Vi

iphone - 行动 :@selector(showAlert:) how to pass parameter in this showAlert method?

我正在向我的UITableViewCell添加自定义按钮。在该按钮的操作中,我想调用showAlert:函数并希望在该方法中传递单元格标签。如何在showAlert方法中传递参数:action:@selector(showAlert:)? 最佳答案 如果您在Tableviewcell中使用Button,那么您必须将标签值添加到每个单元格的按钮,并使用id作为参数设置方法addTarget。示例代码:您必须在cellForRowAtIndexPath方法中键入以下代码。{//Settagtoeachbuttoncell.btn1.ta