关闭

回调 performSelectorOnMainThread:withObject:nil waitUntilDone:NO 当设置为yes事界面无法正常显示??

396人阅读 评论(0) 收藏 举报
分类:

//

//  LogInViewController.m

//  productInfoApp

//

//  Created by DING FENG on 13-12-2.

//  Copyright (c) 2013 anYuKeJi. All rights reserved.

//


#import "LogInViewController.h"


@interface LogInViewController ()


@end


@implementation LogInViewController


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

{

    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

    if (self) {

        // Custom initialization

    }

    return self;

}


- (void)viewDidLoad

{

    [super viewDidLoad];

    // Do any additional setup after loading the view from its nib.

    if( ([[[UIDevice currentDevice] systemVersion] doubleValue]>=7.0))

    {

        self.edgesForExtendedLayout= UIRectEdgeNone ;

        self.extendedLayoutIncludesOpaqueBars = YES;

        self.modalPresentationCapturesStatusBarAppearance = YES;

        self.navigationController.navigationBar.translucent = NO;

    }

    else

    {

    }

    if( ([[[UIDevice currentDevice] systemVersion] doubleValue]>=7.0))

    {

        [self.navigationController.navigationBar setBarTintColor: UICOLOR1];

    }

    else{

        self.navigationController.navigationBar.tintColorUICOLOR1;

    }

    UIButton* btnSignIn = [UIButton buttonWithType:UIButtonTypeCustom];

    btnSignIn.frame =CGRectMake(-20, 5, 100, 35);

    [btnSignIn setTitle:@"返回" forState:UIControlStateNormal];

    [btnSignIn.titleLabel setFont:[UIFont systemFontOfSize:15]];

    [btnSignIn addTarget: self action: @selector(back) forControlEvents: UIControlEventTouchUpInside];

    [self.navigationController.navigationBar  addSubview:btnSignIn];

    

    

    

    [individualUser sharedInstance].theTarget = self;

    [individualUser sharedInstance].theSelect = @selector(back);


}


- (void)didReceiveMemoryWarning

{

    [super didReceiveMemoryWarning];

    

    // Dispose of any resources that can be recreated.

}


-(void)back    //  别处写了个回调   /**[self.theTarget performSelector:self.theSelect withObject:nil**/   这里也可以实施 performSelectorOnMainThread

 

{

    

    NSLog(@"2currentThreadjj%@",[NSThread currentThread]);



    [self performSelectorOnMainThread:@selector(VD) withObject:nil waitUntilDone:NO]; 



//***这个地方yes or no有区别   一开始以为performSelectorOnMainThread的作用***//

    NSLog(@"____1");

    

    

}

- (IBAction)login:(id)sender

{

    

    [[individualUser sharedInstance] onClickTencentOAuth];

}


-(void)VD

{


    NSLog(@"3currentThreadjj%@",[NSThread currentThread]);

    [self dismissModalViewControllerAnimated:YES];

    NSLog(@"hehehhe");

    NSLog(@"jj%d",[[NSThread currentThread] isMainThread]);

    NSLog(@"____2");


}


@end



0
0

猜你在找
【直播】机器学习&数据挖掘7周实训--韦玮
【套餐】系统集成项目管理工程师顺利通关--徐朋
【直播】3小时掌握Docker最佳实战-徐西宁
【套餐】机器学习系列套餐(算法+实战)--唐宇迪
【直播】计算机视觉原理及实战--屈教授
【套餐】微信订阅号+服务号Java版 v2.0--翟东平
【直播】机器学习之矩阵--黄博士
【套餐】微信订阅号+服务号Java版 v2.0--翟东平
【直播】机器学习之凸优化--马博士
【套餐】Javascript 设计模式实战--曾亮
查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:3120次
    • 积分:90
    • 等级:
    • 排名:千里之外
    • 原创:6篇
    • 转载:1篇
    • 译文:0篇
    • 评论:0条
    文章分类