Here is the soluntion for all the issue with html select option
Header file:#import
@interface NSObject(SwizzleUIPopOver)
@end
Implementation:#import "NSObject+SwizzleUIPopOver.h"
#import
@implementation NSObject(SwizzleUIPopOver)
BOOL alreadyloaded=false;
+(void)load {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Class class = [self class];
int numClasses = objc_getClassList(NULL, 0);
Class *classes = NULL;
/
/
classes = (__unsafe_unretained Class *)malloc(sizeof(Class) * numClasses);
numClasses = objc_getClassList(classes, numClasses);
for (NSInteger i = 0; i < numClasses; i++)
{
Class superClass = classes[i];
const char * name=class_getName(classes[i]);
NSString *nameOfClass=[NSString stringWithUTF8String:name];
if([nameOfClass isEqual:@"UIWebSelectPopover"])
{
do
{
superClass = class_getSuperclass(superClass);
} while(superClass && superClass != class);
if (superClass == nil)
{
continue;
}
[self swizzleClassWithUserActionDismissedPopover:classes[i]];
}
else if([nameOfClass isEqual:@"UIWebFormRotatingAccessoryPopover"])
{
do
{
superClass = class_getSuperclass(superClass);
} while(superClass && superClass != class);
if (superClass == nil)
{
continue;
}
[self swizzleClassWithAccessporyDone:classes[i]];
}
}
free(classes);
});
}
-(void)byPass_accessoryDone{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
[self byPass_accessoryDone];
});
}
-(void)byPass_userActionDismissedPopover:(id)arg1{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, .5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
[self byPass_accessoryDone];
});
}
+ (void)swizzleClassWithAccessporyDone:(Class)class
{
/
SEL originalShouldSelector = @selector(accessoryDone);
SEL swizzledShouldSelector = @selector(byPass_accessoryDone);
Method originalShouldMethod = class_getInstanceMethod(class, originalShouldSelector);
Method swizzledShouldMethod = class_getInstanceMethod(class, swizzledShouldSelector);
BOOL didAddShouldMethod = class_addMethod(class, originalShouldSelector, method_getImplementation(swizzledShouldMethod), method_getTypeEncoding(swizzledShouldMethod));
if (didAddShouldMethod) {
class_replaceMethod(class, swizzledShouldSelector, method_getImplementation(originalShouldMethod), method_getTypeEncoding(originalShouldMethod));
}
else {
method_exchangeImplementations(originalShouldMethod, swizzledShouldMethod);
}
}
+(void)swizzleClassWithUserActionDismissedPopover:(Class) class{
SEL originalSelector = @selector(_userActionDismissedPopover:);
SEL swizzledSelector = @selector(byPass_userActionDismissedPopover:);
Method originalMethod = class_getInstanceMethod(class, originalSelector);
Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
BOOL didAddMethod = class_addMethod(class, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod));
if (didAddMethod) {
class_replaceMethod(class, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod));
}
else {
method_exchangeImplementations(originalMethod, swizzledMethod);
}
}
@end
But this the swizzle mehtod. works like a charm on our enterprise application