草庐IT

context_dict

全部标签

iphone - CGContextFillRects : invalid context - Objective C

我有这段代码可以为我的图像提供我需要的颜色:-(UIImage*)convertToMask:(UIImage*)image{UIGraphicsBeginImageContextWithOptions(image.size,NO,image.scale);CGRectimageRect=CGRectMake(0.0f,0.0f,image.size.width,image.size.height);CGContextRefctx=UIGraphicsGetCurrentContext();//Drawawhitebackground(forwhitemask)CGContextSet

xcode - swift 2.0 : Type of expression is ambiguous without more context (Using Parse)

我一直收到错误消息“表达式类型不明确,没有更多上下文”。我的代码如下:funcfetchUnviewedUsers(callback:([User])->()){PFQuery(className:"Action").whereKey("byUser",equalTo:(PFUser.currentUser()?.objectId)!).findObjectsInBackgroundWithBlock{(objects,error)->VoidinletseenIDS=map(objects,{$0.objectForKey("toUser")!})PFUser.query()!.wh

ios - 如何在plist中使用dict

我有一个像这样的plist文件horselevel2然后我通过下面的代码加载它letpath=NSBundle.mainBundle().pathForResource("test",ofType:"plist")dataBase=NSDictionary(contentsOfFile:path!)letarray=NSMutableArray()formemberin(dataBase.allKeys){letlevel=member.valueForKey("level")as!Intif(){//dosomething}}当应用程序运行时,它会崩溃。我认为原因是数据库中的成员不能

android.content.Context.getPackageName()' 在空对象引用上

我正在使用实现接口(interface)的fragment。publicclassSigninFragmentextendsFragmentimplementsSigninInterfacefragment类中接口(interface)的方法实现如下。@OverridepublicvoidafterSubmitClicked(StringuserId,Bundlebundle){Log.d(TAG,"CallingtimeafterSubmitClickedcalled"+bundle);if(!userId.equals("-1")){//Loggedinsuccessfully//

android.content.Context.getPackageName()' 在空对象引用上

我正在使用实现接口(interface)的fragment。publicclassSigninFragmentextendsFragmentimplementsSigninInterfacefragment类中接口(interface)的方法实现如下。@OverridepublicvoidafterSubmitClicked(StringuserId,Bundlebundle){Log.d(TAG,"CallingtimeafterSubmitClickedcalled"+bundle);if(!userId.equals("-1")){//Loggedinsuccessfully//

ios - swift - NSPredicate 和 Context Save 运行不正常

我有一个检查核心数据的功能。如果不存在,它应该写入其中(但它不是那样工作的)SoundItems是一个包含收藏对象的数组,mainArray是包含真实对象的数组;@IBActionfuncFavori(_sender:Any){//savecoredataletapp=UIApplication.shared.delegateas!AppDelegateletcontext=app.persistentContainer.viewContextletnewSound=NSEntityDescription.entity(forEntityName:"Sounds",in:context

Android context.getResources.updateConfiguration() 已弃用

就在最近context.getResources()。updateConfiguration()已在AndroidAPI25中弃用,建议使用上下文。createConfigurationContext()而是。有谁知道如何使用createConfigurationContext来覆盖android系统语言环境?在此之前由以下人员完成:Configurationconfig=getBaseContext().getResources().getConfiguration();config.setLocale(locale);context.getResources().updateCon

Android context.getResources.updateConfiguration() 已弃用

就在最近context.getResources()。updateConfiguration()已在AndroidAPI25中弃用,建议使用上下文。createConfigurationContext()而是。有谁知道如何使用createConfigurationContext来覆盖android系统语言环境?在此之前由以下人员完成:Configurationconfig=getBaseContext().getResources().getConfiguration();config.setLocale(locale);context.getResources().updateCon

swift - RemoteNotification Dict 已更改并且 CKNotification Dict 现在有所不同

我希望有人能指导我...我知道Swift2.0/Xcode7仍处于测试阶段,但我需要转换我的代码...这是我的代码...funcapplication(application:UIApplication,didReceiveRemoteNotificationuserInfo:[NSObject:AnyObject]){letnotification:CKNotification=CKNotification(fromRemoteNotificationDictionary:userInfo)//application.applicationIconBadgeNumber=0if(no

ios - 初始化 CBCentralManager : Type of expression is ambiguous without more context

尝试在Swift4.2项目中初始化CBCentralManager。获取评论中显示的错误:importCoreBluetoothclassSomeClass:NSObject,CBCentralManagerDelegate{//Typeofexpressionisambiguouswithoutmorecontextletmanager:CBCentralManager=CBCentralManager(delegate:self,queue:nil)//MARK:-Functions:CBCentralManagerDelegatefunccentralManagerDidUpda