(SEL)如何在一个方法中包含一个方法名 @selector(goSchollNews)

如下:记录


-(void)yesOrNoLogin:(SEL)methods
{
    
    if ([GlobalFunc getLoginStatus] == YES) {
        [self performSelector:methods];
    }else
    {
        LoginViewController *lvc  = [[LoginViewController alloc]init];
        self.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:lvc animated:YES];
        self.hidesBottomBarWhenPushed = NO;
    }
}

下方调用:
goSchollNews是方法名:

switch (icon.marker) {
        case schollNews:
            [self yesOrNoLogin:@selector(goSchollNews)];
            break;
        case ClassZone:
            [self yesOrNoLogin:@selector(sendDynamic)];
            break;
        case addresslist:
            [self yesOrNoLogin:@selector(goAddressBook)];
            break;
        case classAlbum:
            [self yesOrNoLogin:@selector(goClassAlbum)];
            break;
    
        case outOrInBox:
            [self goInBox];
            break;
            
        default:
            break;
    }


你可能感兴趣的:(ios,selector,methods,sel)