uinavigationcontroller导航获取上级view出现unrecognized selector错误

来源:互联网 发布:农村淘宝店小二 编辑:程序博客网 时间:2024/06/07 10:39
各位大侠,求救
我用uinavigationcontroller 的viewControllers objectAtIndex方法获取了上级的VIEW,但在对获取的上级VIEW中的text文本框进行赋值操作时,报unrecognized selector sent to instance 错误。,或者告诉我其他能向上级VIEW的text文本框赋值的方法,非常,万分感谢!
以下是我的代码
#import "CUTTurningQxclSelect3.h"
#import "CUTTruningCalcontentViewController.h"
@interface CUTTurningQxclSelect3 ()

@end

@implementation CUTTurningQxclSelect3

@synthesize list;
@synthesize lastIndexPath;
CUTTruningCalcontentViewController *calcontentView;

- (void)viewDidLoad {
    [super viewDidLoad];
    NSArray *array = [[NSArray alloc] initWithObjects:@"Q195",
                      @"Q215A", @"Q215B", nil];
    self.list = array;
}

- (void)viewDidUnload {
    [super viewDidUnload];
    self.list = nil;
    self.lastIndexPath = nil;
}

#pragma mark -
#pragma mark Table Data Source Methods
- (NSInteger)tableView:(UITableView *)tableView
 numberOfRowsInSection:(NSInteger)section {
    return [list count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView
         cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CheckMarkCellIdentifier = @"CheckMarkCellIdentifier";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:
                             CheckMarkCellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc]
                initWithStyle:UITableViewCellStyleDefault
                reuseIdentifier:CheckMarkCellIdentifier];
    }
    NSUInteger row = [indexPath row];
    NSUInteger oldRow = [lastIndexPath row];
    cell.textLabel.text = [list objectAtIndex:row];
    cell.accessoryType = (row == oldRow && lastIndexPath != nil) ?
    UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
    
    return cell;
}

#pragma mark -
#pragma mark Table Delegate Methods
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    int newRow = [indexPath row];
    int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
    
    if (newRow != oldRow) {
        UITableViewCell *newCell = [tableView cellForRowAtIndexPath:
                                    indexPath];
        newCell.accessoryType = UITableViewCellAccessoryCheckmark;
        
        UITableViewCell *oldCell = [tableView cellForRowAtIndexPath:
                                    lastIndexPath];
        oldCell.accessoryType = UITableViewCellAccessoryNone;
        lastIndexPath = indexPath;
    }
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

    calcontentView=[[CUTTruningCalcontentViewController alloc] init];
    
    calcontentView=[self.navigationController.viewControllers objectAtIndex:([self.navigationController.viewControllers count]-4)];
        NSLog(@"返回根目录");
    calcontentView.qxclText.text=@"Test";
//
    
    [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:([self.navigationController.viewControllers count]-4)] animated:YES];
    
    
}

@end

其中   calcontentView.qxclText.text=@"Test";这一行报错
2013-04-10 11:33:12.487 CutingPro[1256:c07] 返回根目录
2013-04-10 11:33:12.487 CutingPro[1256:c07] -[CUTTurningCalpageController qxclText]: unrecognized selector sent to instance 0x71d4210
2013-04-10 11:33:12.488 CutingPro[1256:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CUTTurningCalpageController qxclText]: unrecognized selector sent to instance 0x71d4210'
*** First throw call stack:
(0x1ca2012 0x10dfe7e 0x1d2d4bd 0x1c91bbc 0x1c9194e 0x79df 0xd3285 0xd34ed 0xadd5b3 0x1c61376 0x1c60e06 0x1c48a82 0x1c47f44 0x1c47e1b 0x1bfc7e3 0x1bfc668 0x23ffc 0x1f8d 0x1eb5)
libc++abi.dylib: terminate called throwing an exception
0 0
原创粉丝点击