0

저는 iOS 및 그 개발을 처음 사용합니다. 나는 아이폰 application.there 내가 UITableView 및 UIWebView가 개발하고있어. UITableview의 셀을 클릭하면 UIWebView에 다양한 웹 페이지가로드됩니다. 그 때문에 나는 EssentialViewController.there에서 DeatailViewController에 문자열 링크를 전달해야한다. Errors.please가 나를 도와주고있다.UIView 컨트롤러와 UITableViewController 사이의 값 전달

오류 로그

2014-07-07 07:09:53.511 WADTourisum[564:60b] -[UINavigationController currentActiveNVC]: unrecognized selector sent to instance 0x8e9b650 
2014-07-07 07:09:53.514 WADTourisum[564:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UINavigationController currentActiveNVC]: unrecognized selector sent to instance 0x8e9b650' 
*** First throw call stack: 
(
    0 CoreFoundation      0x01a421e4 __exceptionPreprocess + 180 
    1 libobjc.A.dylib      0x0158f8e5 objc_exception_throw + 44 
    2 CoreFoundation      0x01adf243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275 
    3 CoreFoundation      0x01a3250b ___forwarding___ + 1019 
    4 CoreFoundation      0x01a320ee _CF_forwarding_prep_0 + 14 
    5 WADTourisum       0x00002c9b -[AMSlideMenuContentSegue perform] + 171 
    6 UIKit        0x007b3f0c -[UIStoryboardSegueTemplate _perform:] + 174 
    7 UIKit        0x0037041c -[UIViewController performSegueWithIdentifier:sender:] + 72 
    8 WADTourisum       0x00013b03 -[Essentialinfocontroller tableView:didSelectRowAtIndexPath:] + 179 
    9 UIKit        0x003399a1 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1513 
    10 UIKit        0x00339b14 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 279 
    11 UIKit        0x0033e10e __38-[UITableView touchesEnded:withEvent:]_block_invoke + 43 
    12 UIKit        0x0026d0aa ___afterCACommitHandler_block_invoke + 15 
    13 UIKit        0x0026d055 _applyBlockToCFArrayCopiedToStack + 403 
    14 UIKit        0x0026ce76 _afterCACommitHandler + 532 
    15 CoreFoundation      0x01a0a36e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30 
    16 CoreFoundation      0x01a0a2bf __CFRunLoopDoObservers + 399 
    17 CoreFoundation      0x019e8254 __CFRunLoopRun + 1076 
    18 CoreFoundation      0x019e79d3 CFRunLoopRunSpecific + 467 
    19 CoreFoundation      0x019e77eb CFRunLoopRunInMode + 123 
    20 GraphicsServices     0x03a365ee GSEventRunModal + 192 
    21 GraphicsServices     0x03a3642b GSEventRun + 104 
    22 UIKit        0x0024ff9b UIApplicationMain + 1225 
    23 WADTourisum       0x000046fd main + 141 
    24 libdyld.dylib      0x02089701 start + 1 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 
(lldb) 

EssetialViewController.h

import <UIKit/UIKit.h> 
#import "DetailViewController.h" 

@interface Essentialinfocontroller : UIViewController<UITableViewDataSource,UITableViewDelegate> 

@property (weak, nonatomic) IBOutlet UITableView *info; 
@property (nonatomic,strong) NSDictionary * courses; 
@property (nonatomic, strong)NSArray *coursekeys; 

@property (nonatomic,retain)IBOutlet DetailViewController * myWebview; 

@property(nonatomic,strong) NSString* customeLink; 

@end 

EssetialViewController.m

#import "Essentialinfocontroller.h" 
@interface Essentialinfocontroller() 
@end 
@implementation Essentialinfocontroller 
@synthesize myWebview; 
@synthesize courses;//dictionary type object 
@synthesize coursekeys; //array type object 
@synthesize customeLink; 
- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    NSString *myfile= [[NSBundle mainBundle]pathForResource:@"essentialinfo" ofType:@"plist"]; 

    // NSLog(@"testing path %@",myfile); 

    courses=[[NSDictionary alloc]initWithContentsOfFile:myfile]; 

    coursekeys =[courses allKeys]; 

} 

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{ 
    return [courses count]; 
} 


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    UITableViewCell * cell=[[ UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"]; 

    NSString * currentCourseName =[coursekeys objectAtIndex:[indexPath row]]; 

    [[cell textLabel]setText:currentCourseName]; 

    cell.accessoryType =UITableViewCellAccessoryDisclosureIndicator; 

    return cell; 
} 

//implement stack method 

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 




    if(indexPath.row==0){ 

     [self performSegueWithIdentifier:@"segue" sender:self];//**Error is here** 


     UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; 

     UIViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"story"]; 

     [email protected]"https://www.facebook.com/"; 



     [self.navigationController pushViewController:viewController animated:YES]; 


    } 
    if (indexPath.row==1) { 
     NSLog(@"myUrl-->2 "); 

    } 



} 

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 
{ 
    // Make sure your segue name in storyboard is the same as this line 
    if ([[segue identifier] isEqualToString:@"segue"]) 
    { 

     DetailViewController *vc = [segue destinationViewController]; 

     vc.link=customeLink; 
    } 
} 

//end 

- (void)didReceiveMemoryWarning 
{ 
    [super didReceiveMemoryWarning]; 

} 

@end 

DetailViewController.h

#import <UIKit/UIKit.h> 

@interface DetailViewController : UIViewController 

@property (weak, nonatomic) IBOutlet UIWebView *info; 

@property(strong,nonatomic)NSString * link; 

@end 
백45경1천5백15조5백36억9천1백36만3천2백10

DetailViewController.m

#import "DetailViewController.h" 

@interface DetailViewController() 

@property(nonatomic,weak)NSString *customelink; 
@end 

@implementation DetailViewController 

@synthesize info; 

@synthesize link; 

@synthesize customelink; 

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 
{ 
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 
    if (self) { 
     // Custom initialization 
    } 
    return self; 
} 

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    self.customelink=self.link; 


    NSLog(@"link--> %@",self.customelink); 

    NSURL *url= [NSURL URLWithString:customelink]; 
    NSURLRequest * requestURL= [NSURLRequest requestWithURL:url]; 
    [info loadRequest:requestURL]; 


} 

- (void)didReceiveMemoryWarning 
{ 
    [super didReceiveMemoryWarning]; 

} 

@end 

My Segue image

enter image description here

답변

1

didSelectRowAtIndexPath

- (void)tableView:(UITableView *)tableView 
         didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 
    if(indexPath.row==0) 
    { 
     [self performSegueWithIdentifier:@"segue" sender:self]; 
    } 
} 

prepareForSegue

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 
{ 
    // Make sure your segue name in storyboard is the same as this line 
    if ([[segue identifier] isEqualToString:@"segue"]) 
    { 
     DetailViewController *vc = [segue destinationViewController]; 
     [email protected]"https://www.facebook.com/"; 
    } 
} 
관련 문제