小编P.B*_*P.B的帖子

IPhone - 全屏UIScrollView启动正确但重新定位在导航栏下方

I am currently trying to implement a photo picker just like the Photo App but with a custom image source. For the "photo scrolling" part I used the Apple PhotoScroller sample code and adapted it. One of the main difference is that it is now embedded in a navigation controller (wich is the photoPicker own nav controller, not the application's one) , with a navigation bar. I have the status and navigation bar translucent and I did set wantsFullScreenLayout = …

iphone fullscreen scrollview offset navigationbar

5
推荐指数
2
解决办法
4730
查看次数

class_getClassMethod经常返回nil(似乎只适用于类级别方法)

我目前正在尝试使用http://sudzc.com/中的一些生成代码. 这段代码并不完全适合我的Web服务,因此我尝试将类别添加到一些生成的类中,并使用原始类替换它们的实现来自"objc/runtime.h"的method_exchangeImplementations.(我可以直接修改生成的代码,但我想避免它).

这是我在MyAppAppDelegate中执行的代码 - applicationDidFinishLaunching方法

Class theClass = [CBMayaIPhoneUser class];
Method originalMethod = class_getClassMethod(theClass, @selector(initWithNode:));
Method categoryMethod = class_getClassMethod(theClass, @selector(initWithAllStringNode:));
method_exchangeImplementations(originalMethod, categoryMethod);

theClass = [Soap class];
originalMethod = class_getClassMethod(theClass, @selector(getNodeValue:withName:));
categoryMethod = class_getClassMethod(theClass, @selector(getHrefNodeValue:withName:));
method_exchangeImplementations(originalMethod, categoryMethod);

theClass = [SoapRequest class];
originalMethod = class_getClassMethod(theClass, @selector(send));
categoryMethod = class_getClassMethod(theClass, @selector(sendIgnoringCertificate));
method_exchangeImplementations(originalMethod, categoryMethod);
originalMethod = class_getClassMethod(theClass, @selector(connectionDidFinishLoading:));
categoryMethod = class_getClassMethod(theClass, @selector(connectionDidFinishLoadingAndSentBody:));
method_exchangeImplementations(originalMethod, categoryMethod);
Run Code Online (Sandbox Code Playgroud)

正如我的问题所述,几乎所有这些class_getClassMethod都返回nil ...我使用了调试器,所以我知道'theClass'是正确设置的.找到的唯一方法是Soap类,它们都是类级(+)方法.但是从网上的各种例子中我得出的结论是,它也适用于其他人......

以下是MyAppAppDelegate.m的包含:

#import "MyAppAppDelegate.h"
#import "RootViewController.h"
#import "MyGlobalVariables.h"
#import "MyWebServiceExample.h"
#import "Soap+Href.h"
#import "SoapRequest+Certificate.h"
#import "CBMayaIPhoneUser+AllString.h"
#import …
Run Code Online (Sandbox Code Playgroud)

implementation exchange-server objective-c-runtime ios-simulator

1
推荐指数
1
解决办法
2142
查看次数