草庐IT

objc-category

全部标签

ios - 如何在 ObjC 中成功检查 pin 时弹出 AlertView?

我正在尝试创建一个小应用程序,用户需要在其中输入正确的pin上的pin,它会说correctpinelsewrong但我不确定下面的逻辑是否正确。我在最新的Mac版本上使用Xcode10。-(IBAction)validatePin:(id)sender{[ViewControllercheckPin:self.textPin.text.integerValue];}+(BOOL)checkPin:(NSInteger)pin{if(pin==1408){//[UIAlertControlleralertControllerWithTitle:@"Pin"message:@"Succe

ios - 我在 MonoTouch 中对 UIButton 进行了子类化,但底层的 ObjC 类仍然是 UIButton

我有BackButton继承UIButton。它没有xib,非常简单并且包含一些我省略的布局逻辑。这是我声明它的方式:[Register("BackButton")]publicclassBackButton:UIButton{publicBackButton(stringtext,EventHandlerhandler):base(UIButtonType.Custom){TouchUpInside+=handler;SetTitle(text,UIControlState.Normal);}publicBackButton(IntPtrhandle):base(handle){}}

ios - XCode 4.3, "Cannot define category for undefined class"使用多个 header

直到最近,我有一个项目在XCode中编译得很好;但是现在我正在为以下内容挠头:Cannotdefinecategoryforundefinedclass'myClass'我有一个通过类别扩展另一个标题的标题,如下所示:我的类.h@interfacemyClass:UIView@property....-(void)method....@end我的类+我的类别.h#import"myClass.h"@interfacemyClass(MyCategory)-(void)method2...@end我的类.m#import"myClass.h"#import"myClass+myCateg

objective-c - 苹果错误 - "_OBJC_CLASS_$_TFHpple"

我的应用程序使用Hpple。我包括了TFHpple.h、TFHpple.m、TFHppleElement.h、TFHppleElement.m、XPathQuery.h和XPathQuery.m。还包括${SDKROOT}/usr/include/libxml2和-lxml2。我有这么一小段代码:NSData*data=[[NSDataalloc]initWithContentsOfFile:@"example.html"];TFHpple*xpathParser=[[TFHpplealloc]initWithHTMLData:data];当我尝试运行它时,我收到此错误:"_OBJC_

ios - Objective-C : how to inherit category methods loaded in a parent class?

在我的项目中,我使用了NSObject+Properties.h类别(参见aqtoolkit:https://github.com/AlanQuatermain/aqtoolkit/blob/master/Extensions/NSObject%2BProperties.h)然后我有一个我声明为的类#import#import"NSObject+Properties.h"@interfaceGFDictionaryInitiable:NSObject...然后我有几个GFDictionaryInitiable的子类,例如GFRestaurant:#import#import"GFDic

ios - UINavigationController supportedInterfaceOrientations : category vs swizzle

我在我的iPhone应用程序中使用带有多个UINavigationController的tabBarController,现在我想添加对旋转的支持(在某些ViewController上,不是全部)。我知道我需要为我的UIViewControllers实现supportedInterfaceOrientation方法。当设备旋转时,会在UINavigationController上调用supportedInterfaceOrientation,但我需要在我的viewController上调用它。执行此操作的最佳方法是什么?我看到有些人在UINavigationController上创建了

ios - 使用 -ObjC/-all_load 链接器标志时找不到符号

更新到Xcode6后,我在IOS7上遇到此代码崩溃并显示“找不到符号:_OBJC_CLASS_$_UIUserNotificationSettings”,任何人都可以帮助解决它if([applicationrespondsToSelector:@selector(registerUserNotificationSettings:)]){UIUserNotificationSettings*settings=[UIUserNotificationSettingssettingsForTypes:(UIUserNotificationTypeSound|UIUserNotification

ios - -ObjC 上相互矛盾的框架

所以在我的项目中,我有FacebookSDK、ParseSDK和FirebaseSDK。Facebook和parse都需要bolt,所以我实现了它。但是,除非我删除-Objcflags,否则它不会编译。问题是,如果我删除此标记,代码将编译,但在尝试初始化Firebase时会导致运行时错误,因为它需要-ObjC。我一团糟。我可以只为那个特定的框架设置标志吗?感谢您的帮助。 最佳答案 (我认为这应该是一个评论,但我还没有足够的代表,希望这有助于解决这个问题。)我遇到了完全相同的问题(使用SponsorPaySDK而不是FirebaseS

iphone - ObjC : how to insert component to url from A/B to A/between/B?

我需要操作一些URL,以这种方式向其添加组件:/img/david/PlayBasketball.jpg将变成:/img/HiRes/david/PlayBasketball.jpg在iPhone的ObjectiveC中,我该怎么做?提前致谢! 最佳答案 使用NSString方法pathComponents和pathWithComponents:NSString*p=@"/img/david/PlayBasketball.jpg";NSMutableArray*cmps=[NSMutableArrayarrayWitharray:[

ios - objc_msgSend() 传递了 "a pointer to the reciever' s 数据是什么意思”?

在Apple的ObjC运行时指南中,它描述了objc_msgSend()函数对动态调度的作用:Itfirstfindstheprocedure(methodimplementation)thattheselectorrefersto.Sincethesamemethodcanbeimplementeddifferentlybyseparateclasses,thepreciseprocedurethatitfindsdependsontheclassofthereceiver.Itthencallstheprocedure,passingitthereceivingobject(apo