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

原创 2013年12月03日 09:11:32

//

//  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



performSelectorOnMainThread

[selfperformSelectorOnMainThread:@selector(fetchedData:) withObject:datawaitUntilDone:YES]; 会创建一个...
  • EricSuper
  • EricSuper
  • 2011-11-22 08:47:36
  • 23174

多线程的使用(1) - performSelectorOnMainThread

在做项目中,要提高效率,就必须使用多线程。 多线程,在网上搜索,有很多方法使用。 今天,接触到了performSelectorOnMainThread 方法。 NSAutoreleasePool...
  • sirodeng
  • sirodeng
  • 2013-05-23 22:53:54
  • 8037

performSelectorOnMainThread:withObject: waitUntilDone 用法

[self performSelectorOnMainThread:@selector(callBack) withObject:nil waitUntilDone:YES]; waitUnti...
  • sbvfhp
  • sbvfhp
  • 2014-03-11 14:15:46
  • 3044

performSelectorOnMainThread:withObject: waitUntilDone 参数解释

performSelectorOnMainThread: withObject: waitUntilDone: 前两个参数不解释,最后一个waitUntilDone我看网上很多朋友都在问,解释一下。 ...
  • hhcncx
  • hhcncx
  • 2016-03-05 17:45:31
  • 611

IOS学习--performSelectorOnMainThread

iphone开发中,在主线程之外的线程更新主线程所显示的界面元素,不能直接调用主线程的类的更新界面的方法,否则界面看不到任何结果 .而是需要有个缓冲,叫做 performSelectorOnMai...
  • jiantiantian
  • jiantiantian
  • 2013-10-30 14:31:02
  • 5110

performSelectorOnMainThread 和detachNewThreadSelector区别.

举例说明怎么简单的创建一个子线程。 用到的类是NSThread类,这里使用detachNewTheadSelector:toTagaet:withObject创建一个线程。 函数setupThre...
  • zhibudefeng
  • zhibudefeng
  • 2012-06-19 17:10:16
  • 3903

iOS: performSelectorOnMainThread waitUntilDone 参数详解

http://www.41443.com/HTML/iphone/20150126/300050.html iOS 中performSelectorOnMainThread  参数 waitUnti...
  • jeffasd
  • jeffasd
  • 2016-05-17 15:16:33
  • 1756

深入分析iOS问题-performSelector:onThread:withObject:waitUntilDone

今天检查内存泄露的问题,发现误用系统API的问题。导致内存泄露。这个问题还是比较常见的,我觉得还是记下了,分享给大家...
  • bjtufang
  • bjtufang
  • 2015-09-23 23:31:03
  • 2143

ios更新UI时请尝试使用performSelectorOnMainThread方法

最近开发项目时发现联网获取到数据后,使用通知方式让列表刷新会存在死机的问题。 经过上网查找很多文章,都建议使用异步更新的方式,可是依然崩溃。 最后尝试使用performSelectorOn...
  • th_gsb
  • th_gsb
  • 2015-06-26 16:56:45
  • 5578

performSelectorOnMainThread:withObject:waitUntilDone: not found in proctrol

最近写了个服务器交互类,里面有这么一段代码: ... @property (nonatomic, assign) id delegate; ... [self.delegate performSe...
  • u013660421
  • u013660421
  • 2014-04-15 08:45:21
  • 485
收藏助手
不良信息举报
您举报文章:回调 performSelectorOnMainThread:withObject:nil waitUntilDone:NO 当设置为yes事界面无法正常显示??
举报原因:
原因补充:

(最多只允许输入30个字)