`
wang_peng1
  • 浏览: 3944366 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

isKindOfClass

 
阅读更多
override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {

    super.touchesBegan(touches, withEvent: event)
    let touch : UITouch = touches.anyObject() as UITouch

    if touch.view.isKindOfClass(UIPickerView)
    {

    }
}

if let picker = touch.view as? UIPicker  {

    }

 

分享到:
评论

相关推荐

    isKindOfClass和isMemberOfClass的底层区别

    BOOL res1 = [(id)[NSObject class]isKindOfClass:[NSObject class]];//1 BOOL res2 = [(id)[NSObject class]isMemberOfClass:[NSObject class]];//0 BOOL res3 = [(id)[LGPerson class]isKindOfClass:[LGPerson ...

    iOSSorted排序

    if ([obj1 isKindOfClass:[NSString class]] && [obj2 isKindOfClass:[NSString class]]) { ChineseString *str1 = [[ChineseString alloc] initWithString:obj1]; ChineseString *str2 = [[ChineseString alloc]...

    地图上显示用户头像

    if ([annotation isKindOfClass:[MKPointAnnotation class]]) { static NSString *customReuseIndetifier = @"customReuseIndetifier"; CusAnnotationView *annotationView = (CusAnnotationView *)[mapView ...

    iOS常见算法以及应用知识点总结

    ([array isKindOfClass:[NSArray class]] || [array isKindOfClass:[NSMutableArray class]])) { NSLog(@"传入的参数不是数组类型"); return; } NSMutableArray *tmpArr = [array isKindOfClass:[NSMutableArray...

    UINavigationBar Category

    if ([subview isKindOfClass:NSClassFromString(@"UINavigationItemView")]) { for (UIButton *button in subview.subviews) { if ([button isKindOfClass:[UIBarButtonItem class]]) { button.frame = button....

    自定义MPVolumeView

    } else if subview.isKindOfClass(UIBarButtonItem) { // 隐藏音量按钮 subview.hidden = true } } ``` 然而,自定义MPVolumeView并非简单地改变其外观,因为它是系统控件,很多属性和方法是私有的,无法直接...

    ios自定义键盘附件关闭键盘

    if ([currentFirstResponder isKindOfClass:[UITextField class]] || [currentFirstResponder isKindOfClass:[UITextView class]]) { [currentFirstResponder resignFirstResponder]; } } ``` 这样,当用户...

    Objective-C入门指南

    - 类型转换(`[object isKindOfClass:]`) - **类别(Categories)** - 扩展已有类的功能 - 无需修改原类即可添加新方法 - **角色(Posing)** - 角色允许一个类表现为另一个类 - 通过实现特定协议实现角色功能 - **...

    json解析库

    } else if ([result isKindOfClass:[NSDictionary class]]) { NSDictionary *dictResult = (NSDictionary *)result; // 处理字典 } ``` 除了sbjson,还有其他流行的JSON解析库,如“AFNetworking”的内置JSON解析...

    ios-AFNetworking简单封装(简单cell多布局).zip

    } else if ([item isKindOfClass:[NewsImageItem class]]) { NewsImageCell *cell = [tableView dequeueReusableCellWithIdentifier:@"NewsImageCell"]; cell.imageView.image = ((NewsImageItem *)item).image; ...

    RuntimeDemo

    Runtime提供了反射能力,让我们能够在运行时检查对象的类型,如`object_isKindOfClass:`判断对象是否属于某个类,`-[NSObject isKindOfClass:]`是其面向对象的接口。此外,`-[NSObject performSelector:]`允许我们...

    ios json测试demo

    if ([jsonObject isKindOfClass:[NSDictionary class]]) { NSDictionary *dict = (NSDictionary *)jsonObject; // 处理解析后的字典数据 } else if ([jsonObject isKindOfClass:[NSArray class]]) { NSArray *...

    Objective-C 入门指南基础与实践.docx

    } else if ([object isKindOfClass:[Employee class]]) { // Do something with an Employee object } ``` #### 五、内存管理 Objective-C 使用引用计数进行内存管理,你需要手动管理对象的引用。 1. **...

    AvoidCrash.zip

    [key isKindOfClass:[NSString class]]) { NSLog(@"[AvoidCrash] Key must be non-nil and a string."); return; } if (!obj) { NSLog(@"[AvoidCrash] Object is nil, not setting key: %@", key); return; }...

    IOS NSKeyedArchiver

    } else if ([unarchivedObject isKindOfClass:[YourCustomClass class]]) { YourCustomClass *restoredObject = unarchivedObject; // 处理恢复的单个对象 } ``` 5. **安全注意事项**: - 归档和解档操作应该...

    IOS面试题--(某大型移动互联网公司)

    5. NSObject的内省方法:`init`是初始化方法,而`isKindOfClass:`和`responseToSelector:`是内省方法,`isMemberOfClass:`属于内省的一部分,但`init`不是。 6. 声明可选实现的函数:在声明协议时,使用`@optional`...

    JSON_IPHONE

    } else if ([jsonObject isKindOfClass:[NSDictionary class]]) { NSDictionary *dict = (NSDictionary *)jsonObject; // 处理字典内容 } } else { NSLog(@"Error parsing JSON: %@", error); } ``` 5. **编码...

    判断字符串是否是空

    if ([string isKindOfClass:[NSNull class]]) { NSLog(@"字符串是NULL"); } else if (string == nil) { NSLog(@"字符串是nil"); } else { NSLog(@"字符串非空"); } ``` 这适用于检查字符串是否为`NSNull`对象或`...

    Objective-C简单继承代码

    } else if ([person isKindOfClass:[Teacher class]]) { Teacher *teacher = (Teacher *)person; [teacher teach]; } } ``` 这个方法首先调用`sayHello`,然后根据对象的实际类型(是`Student`还是`Teacher`)...

    iOS开发使用JSON解析网络数据

    if ([jsonObject isKindOfClass:[NSArray class]]) { self.dataList = jsonObject; dispatch_async(dispatch_get_main_queue(), ^{ [self.tableView reloadData]; }); } else { NSLog(@"Error parsing JSON: ...

Global site tag (gtag.js) - Google Analytics