程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> respondsToSelector判斷是否實現了某方法

respondsToSelector判斷是否實現了某方法

編輯:C++入門知識

[cpp]
  if ([self respondsToSelector:@selector(request)]) { 
        NSLog(@"request is exit"); 
    }else 
    { 
        NSLog(@"request is exit"); 
    } 
     
    if ([self respondsToSelector:@selector(request1)]) { 
        NSLog(@"request1 is exit"); 
    }else 
    { 
          NSLog(@"request1 is not exit"); 
    } 
 
-(void)request 

    __block NBProgressHUD* nBProgres; 
    dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{ 
        dispatch_async(dispatch_get_main_queue(), ^{ 
        }); 
        NSMutableDictionary* postData=[NSMutableDictionary new]; 
        [postData setObject:@"api.doctor.login" forKey:@"apiName"]; 
        [postData setObject:@"sun" forKey:@"check_number,%@"]; 
        [postData setObject:@"123456" forKey:@"password,%@"]; 
   
        dispatch_async(dispatch_get_main_queue(), ^{ 
        }); 
    }); 
 

    if ([self respondsToSelector:@selector(request)]) {
        NSLog(@"request is exit");
    }else
    {
        NSLog(@"request is exit");
    }
   
    if ([self respondsToSelector:@selector(request1)]) {
        NSLog(@"request1 is exit");
    }else
    {
          NSLog(@"request1 is not exit");
    }

-(void)request
{
    __block NBProgressHUD* nBProgres;
    dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
        dispatch_async(dispatch_get_main_queue(), ^{
        });
        NSMutableDictionary* postData=[NSMutableDictionary new];
        [postData setObject:@"api.doctor.login" forKey:@"apiName"];
        [postData setObject:@"sun" forKey:@"check_number,%@"];
        [postData setObject:@"123456" forKey:@"password,%@"];
 
        dispatch_async(dispatch_get_main_queue(), ^{
        });
    });

}

 


 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved